PDA

View Full Version : Join?


edbr
09-03-2008, 08:34 AM
I cant get my head around this. I have two tables one main with details and another with special prices. so,
a simple select on the later is
$ssql = "SELECT title FROM late WHERE this =1 && late=1";
$result = mysql_query($ssql);
$late = mysql_fetch_array($result);
the details i want are 'beds' ,'area', from the other table using 'title as a match in both tables. then return them in a do-while loop.
i have been trying to join them and then use an if but am not getting it right.
Best way? before i give up and put all the info in one table

davidj
09-03-2008, 04:51 PM
SELECT * FROM table1 LEFT JOIN table2 on table1.id=table2.id WHERE table2.this =1 AND table1.late=1

edbr
09-04-2008, 02:30 AM
outstanding, the pain in my head has gone away.