DotDragnet
May 23, 2012, 10:47:12 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: follow us on twitter @dotdragnet
 
   Home   Help Search Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Another SQL question  (Read 252 times)
Charisma Bypass
Hero Member
*****
Posts: 556



View Profile Awards
« on: February 22, 2011, 10:14:04 AM »

$p_query = mysql_query("
select pd.p_id, pd.p_name, c2p.c_p_status
from p2c left join c2p on p2c.p_id = c2p.p_id and c2p.c_id = '1'
where pd.p_id = p2c.p_id and pd.l_id = '2'
and p2c.c_id = '3'");

What I need to add into the mix is another table "s" - and from that get the value of s.s_n_p_p and s.s

The link will be on s.p_id which is the same as pd.p_id and p2c.p_id and c2p.p_id.  It is very possible that no record would exist in "s" that matches.

I'm struggling, any help would be greatly appreciated with a paypal beer or two.
Logged
Charisma Bypass
Hero Member
*****
Posts: 556



View Profile Awards
« Reply #1 on: February 22, 2011, 10:46:02 AM »

Write it down, have a cup of coffee, and it becomes clear. 

pd left join s on pd.products_id = s.products_id,

D'oh.

Sorry chaps.
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF | SMF © 2006-2008, Simple Machines Valid XHTML 1.0! Valid CSS!