MySQL Left Join help -
Hello community then,
I posted a question an hour ago SQL query, which promptly responded It was a great help and regret was, however, on reflection and further usage, it has been found that the query was returning all the rows in the target table. I have validated it by adding mysql_fetch_object in a while.
So now what do I need to keep an eye on SQL queries and tell me what is going wrong and how to fix it if possible. When using $ _SESSION ['model'] as a reference, I just need one line (the correct line).
Below is the complete content of my previous question.
Thank you in advance.
=========================================== =================================
Web_quite_models table
< Code> id | Model | Product_id | Cpu_id | RAM_ID | HDDID | Os_id | Opt_id ================================================= ======================== 1 | 000001 | 1 | 1 | 1 | 1 | 1 | 1 2 | 000002 | 1 | 2 | 2 | 2 | 2 | 2 3 | 000003 | 1 | 3 | 3 | 3 | 3 | 3 4 | 000004 | 1 | 4 | 4 | 4 | 4 | 4web_quote_component_cpu table
id | Name ================================================= ========================= 1 | Intel & amp; Reg; Core & amp; business; I3 2100 3.1GHz Dual Core 2 | Intel & amp; Reg; Core & amp; business; I5 2500 2.7GHz Quad-Core 3 | Intel & amp; Reg; Core% business; I7 2600 3.4GHz 8MB cache dual core
So I need to find that he is a query that will appear within web_quote_models table and $ _SESSION [ 'models'] with model field Corresponds to Then match the web_quote_models.cpu_id field with web_quote_component.id.
It is so far from me; I think I can not be too far
web_quote_component_cpu.id on web_quote_models leave web_quote_component_cpu web ( "web_quote_component_cpu.name = web_quote_models.cpu_id and web_quote_models.name = '". $ _ SESSION [ideal]. "'") ;
A massive thank you in advance for anyone that helps.
Donations.
which left Insert , you join (the
web_quote_component_cpu ) even if they eat does not match the other table. If you only want entries that match, then
left Join instead of
Connect uses.
What were you asking?
Comments
Post a Comment