![]() |
Understanding LEFT JOIN
I've run into a snag trying to use LEFT JOIN to cut out a query. I'm just a cut-n-paste coder so I can't figure this one out. I am after info from three tables, it's working now with two, but on the third it goes stupid on me. It only shows one listing with id's from seperate.
This is the working code with two tables: Code:
$result_list = $DB_site->query(" Code:
$result_image = $DB_site->query(" |
[sql]$result_list = $DB_site->query("
SELECT vbgarage_users.*, vbgarage_images.*, user.username, user.usertitle FROM " . TABLE_PREFIX . "vbgarage_users AS vbgarage_users, " . TABLE_PREFIX . "vbgarage_images AS vbgarage_images LEFT JOIN " . TABLE_PREFIX . "user ON vbgarage_users.userid = user.userid WHERE vbgarage_images.userid = $list[userid] ORDER BY user.username ASC, vbgarage_images.imageid ASC LIMIT $pos,$perpage ");[/sql]Does that work in your environment? |
All times are GMT. The time now is 04:01 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|