Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

Getting Multiple Rows from a Single Table

$
0
0
Hello All -

I'm really pulling my hair out over something that would appear to be very, very easy.

I'm trying to get data from two columns (fld_04_hrs and fld_08_hrs) based upon "Kayak - Single" and "Kayak - Double" which are in column fld_type.

So, what I need is the 4 hour and 8 hour data for BOTH Kayak Single and Kayak Double.

I've written this query:

$sql =
"SELECT fld_04_hrs, fld_08_hrs
FROM tbl_activities
WHERE fld_type = 'Kayak - Single' OR fld_type = 'Kayak - Double'";

But what I get are only the 4 and 8 hour values for Kayak Single.

So then I tried this query:

$sql =
"SELECT fld_04_hrs, fld_08_hrs FROM
tbl_activities
WHERE fld_type IN('Kayak - Single','Kayak - Double')";

Same result: 4 and 8 hour values for Kayak Single only.

I CAN get the values I need by Select * and then doing a while loop to discard everything but Kayak Single and Kayak Double, but I guess that's about as inefficient as it gets.

What am I doing wrong??? Can someone please help me get this right in one query statement?

Thanks to all in advance!

Viewing all articles
Browse latest Browse all 13329

Trending Articles