Msg#: 4513090 posted 1:38 am on Oct 28, 2012 (gmt 0)
Hello All -
I've been trying various ways of selecting 2 rows of data from the same table, but nothing I do is working.
The only way I've got this to work is by doing 2 separate selects on this one table and then run queries on both selects (yuck!). I know there must be a way to do it (some kind of row join on the table?) but I can't get the syntax right.
The table contains 3 columns: fld_type, fld_04_hrs, and fld_08_hrs. What I want to do is get the 4 hour and 8 hour data for types 'Kayak - Single' AND 'Kayak - Double'.
This doesn't work, but sort of like:
$sql = "SELECT fld_04_hrs, fld_08_hrs FROM tbl_activities WHERE fld_type = 'Kayak - Single' AND fld_type = 'Kayak - Double'";
The 2 selects that work are:
$sql = "SELECT fld_04_hrs, fld_08_hrs FROM tbl_activities WHERE fld_type = 'Kayak - Single'";
$sql = "SELECT fld_04_hrs, fld_08_hrs FROM tbl_activities WHERE fld_type = 'Kayak - Double'";
But I'd really like to grab both pieces of data for both types in one select.
Can someone please show me how to do this?
Great appreciation in advance for anyone who can show me how this is done.