

InterviewSolution
Saved Bookmarks
1. |
Solve : MySQL help needed: LEFT JOIN and INNER JOIN? |
Answer» Hey GUYS, SELECT * FROM new_orders INNER JOIN client_info ON new_orders.client_id = client_info.client_id Now, I need to attached admin_notes to this result set but only some orders have notes and other's don't. I noticed you can't combine INNER JOIN with LEFT JOIN in one statement I tried doing: Quote SELECT * FROM new_orders INNER JOIN client_info ON client_info.client_id = new_orders.client_id, new_orders LEFT JOIN admin_notes ON new_orders.order_id = admin_notes.order_id But this RETURN an error saying new_orders is not unique table/alias. Any ideas how to accomplish this?? THANKS in advance.I made an adjustment to make it work but I'm still not sure if that's the "correct" way of doing it. Basically, now I take new_orders LEFT JOIN client_info then LEFT JOIN admin_notes. It returns correct results for now. There isn't much data in the database so I'll have to wait until someone suggests something better or more data is gathered :/Quote meaning it may or may not be there- SQLyog is a great tool to view databases and see what is there and make changes with with a GUI. The FREE community edition is limited, but still has many useful features. If you ever lose track of a table etc you can use it to see where it went etc.Looks like a great tool DaveLembke, something I may require down the road but how does that help my problem in joining three tables? Thanks. |
|