mysql join
Posted: Sat Aug 02, 2008 6:30 pm
I have three queries which I would like to consolidate into one. I know I need to use JOIN, and I have done some research, but I am still not quite sure. Below are my thee pseudo queries, can someone help consolidate them into one?
$pid = SELECT `id` FROM `widget_layer` WHERE `name` = $position
$mid = SELECT `id` FROM `modules` WHERE `name` = $module AND `enabled` = 1
$result = SELECT `pid` FROM `relation` WHERE `pid` = $pid AND `mid` = $mid
Thanks,
John
$pid = SELECT `id` FROM `widget_layer` WHERE `name` = $position
$mid = SELECT `id` FROM `modules` WHERE `name` = $module AND `enabled` = 1
$result = SELECT `pid` FROM `relation` WHERE `pid` = $pid AND `mid` = $mid
Thanks,
John