I have two tables, table1 and table2. I need to select all records in table1 where table1.name = '$name' and where table1.id = table2.id { table2.url_key = 'google' and table2.url_key = '$url'}
do you know how this would be constructed to be a valid query? cheers
SELECT * FROM `table1` LEFT JOIN `table2` ON `table2`.`id` = `table1`.id` WHERE `table1`.`name` = '$name' AND `table2`.`url_key` = 'google' AND `table2`.`url_key` = '$url'
the only problem is .. how can `table2`.`url_key` be $url AND google at the same time??
sorry, my fault. One of the key's meant to be 'value'. But anyway, your code works.
thanks
SELECT * FROM `table1` LEFT JOIN `table2` ON `table2`.`id` = `table1`.id` WHERE `table1`.`name` = '$name' AND `table2`.`url_key` = 'google' AND `table2`.`url_value` = '$url'
I need to select all records in table1 where
table1.name = '$name'
and where table1.id = table2.id {
table2.url_key = 'google'
and
table2.url_key = '$url'}
do you know how this would be constructed to be a valid query?
cheers
Thanks
the only problem is .. how can `table2`.`url_key` be $url AND google at the same time??
thanks