Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › SQL Select formatting help needed
New Posts  All Forums:Forum Nav:

SQL Select formatting help needed

post #1 of 4
Thread Starter 
My final is due thurs And I still need to:
  • Insert Data into my already created tables
  • Select Multiple Rows in a non-keyed field
  • select data that only returns selected rows
  • select multiple tables
  • select data that is grouped
(This list is just up because I may be posting more question later so I dont make multiple threads)

Here is my situation. I am trying to return data that only meets the criteria for selected fields. One of my tables has personal information incl. health issues. The health issues are formatted in y/n format each as their own row (ex, asthma - y; Epilepsy - n; Diabetes - n; etc) . . . I want to make a select statement that returns the name of the person and all of the health fields only if any of the health fields have a 'y'. This would mean that if a person had any of the health issues asked they would be returned in the search. . . I can do it one at a time But I dont know how (Or if its possible) to do multiple ones at a time.

Here is a make shift output to better describe what Im looking for . . .




Thank you very much for helping me.
 
ESXi Server
(10 items)
 
HTPC
(13 items)
 
CPUMotherboardGraphicsRAM
i7-4790K Asus Sabertooth Mark 2 Radeon HD 6950 GSkill Sniper Series 
Hard DriveCoolingOSMonitor
Samsung XP941 Noctura NH-D14 8.1 Pro QNIX 27", Dell 24", Samsung 22", Sony 24" 
KeyboardPowerCaseMouse
Corsair K95 PC&P 750 NZXT H2 Logitech G500s 
CPUHard DriveHard DriveHard Drive
Phenom II x4 965 WE Red Seagate Intel SSD 
Hard DriveCoolingOSOS
WR Raptor  Silenx Fans x2 120mm Win 7 x2 Unraid 
OSCase
pfsense Rackmount 16 bay hot-swap 
CPUMotherboardGraphicsRAM
i3 2100t Gigabyte integrated 2x 8GB GSkill 
Hard DriveCoolingOSMonitor
OCZ SSD Stock Win7 - Plex Shell Sony XBR2 
PowerCase
Generic 350 watt Repurposed Vidabox 
  hide details  
Reply
 
ESXi Server
(10 items)
 
HTPC
(13 items)
 
CPUMotherboardGraphicsRAM
i7-4790K Asus Sabertooth Mark 2 Radeon HD 6950 GSkill Sniper Series 
Hard DriveCoolingOSMonitor
Samsung XP941 Noctura NH-D14 8.1 Pro QNIX 27", Dell 24", Samsung 22", Sony 24" 
KeyboardPowerCaseMouse
Corsair K95 PC&P 750 NZXT H2 Logitech G500s 
CPUHard DriveHard DriveHard Drive
Phenom II x4 965 WE Red Seagate Intel SSD 
Hard DriveCoolingOSOS
WR Raptor  Silenx Fans x2 120mm Win 7 x2 Unraid 
OSCase
pfsense Rackmount 16 bay hot-swap 
CPUMotherboardGraphicsRAM
i3 2100t Gigabyte integrated 2x 8GB GSkill 
Hard DriveCoolingOSMonitor
OCZ SSD Stock Win7 - Plex Shell Sony XBR2 
PowerCase
Generic 350 watt Repurposed Vidabox 
  hide details  
Reply
post #2 of 4
I thinky you will need to use if-then equations, then you can drag the cells down, but you may need to change the destination of if and then for each cell.
300
(13 items)
 
  
CPUMotherboardGraphicsRAM
3800+ am2 250x10 1.32v epox mf4ultra 7600gt fatal1ty 2gb geil ddr2 533 
Hard DriveOptical DriveOSMonitor
80gb wd sata writemaster dvd ls xp pro 32bit w/ windows x vista acer 22" ws & sony 19" lcd 
KeyboardPowerCaseMouse
g15 logisys 550w 25a 12v 38a 5v 30a 3.3v clear acrylic logitech mx518 
Mouse Pad
big green one 
  hide details  
Reply
300
(13 items)
 
  
CPUMotherboardGraphicsRAM
3800+ am2 250x10 1.32v epox mf4ultra 7600gt fatal1ty 2gb geil ddr2 533 
Hard DriveOptical DriveOSMonitor
80gb wd sata writemaster dvd ls xp pro 32bit w/ windows x vista acer 22" ws & sony 19" lcd 
KeyboardPowerCaseMouse
g15 logisys 550w 25a 12v 38a 5v 30a 3.3v clear acrylic logitech mx518 
Mouse Pad
big green one 
  hide details  
Reply
post #3 of 4
SELECT name FROM table WHERE (field = 'y' OR field2 = 'y' OR field3='y')
Main Rig
(15 items)
 
  
Reply
Main Rig
(15 items)
 
  
Reply
post #4 of 4
Thread Starter 
Cookie for the MOD


 
ESXi Server
(10 items)
 
HTPC
(13 items)
 
CPUMotherboardGraphicsRAM
i7-4790K Asus Sabertooth Mark 2 Radeon HD 6950 GSkill Sniper Series 
Hard DriveCoolingOSMonitor
Samsung XP941 Noctura NH-D14 8.1 Pro QNIX 27", Dell 24", Samsung 22", Sony 24" 
KeyboardPowerCaseMouse
Corsair K95 PC&P 750 NZXT H2 Logitech G500s 
CPUHard DriveHard DriveHard Drive
Phenom II x4 965 WE Red Seagate Intel SSD 
Hard DriveCoolingOSOS
WR Raptor  Silenx Fans x2 120mm Win 7 x2 Unraid 
OSCase
pfsense Rackmount 16 bay hot-swap 
CPUMotherboardGraphicsRAM
i3 2100t Gigabyte integrated 2x 8GB GSkill 
Hard DriveCoolingOSMonitor
OCZ SSD Stock Win7 - Plex Shell Sony XBR2 
PowerCase
Generic 350 watt Repurposed Vidabox 
  hide details  
Reply
 
ESXi Server
(10 items)
 
HTPC
(13 items)
 
CPUMotherboardGraphicsRAM
i7-4790K Asus Sabertooth Mark 2 Radeon HD 6950 GSkill Sniper Series 
Hard DriveCoolingOSMonitor
Samsung XP941 Noctura NH-D14 8.1 Pro QNIX 27", Dell 24", Samsung 22", Sony 24" 
KeyboardPowerCaseMouse
Corsair K95 PC&P 750 NZXT H2 Logitech G500s 
CPUHard DriveHard DriveHard Drive
Phenom II x4 965 WE Red Seagate Intel SSD 
Hard DriveCoolingOSOS
WR Raptor  Silenx Fans x2 120mm Win 7 x2 Unraid 
OSCase
pfsense Rackmount 16 bay hot-swap 
CPUMotherboardGraphicsRAM
i3 2100t Gigabyte integrated 2x 8GB GSkill 
Hard DriveCoolingOSMonitor
OCZ SSD Stock Win7 - Plex Shell Sony XBR2 
PowerCase
Generic 350 watt Repurposed Vidabox 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › SQL Select formatting help needed