Page 1 of 1

query of 2 tables

Posted: Tue Dec 07, 2004 1:08 am
by pelegk2
query of 2 tables
i have this tables :


quote:
--------------------------------------------------------------------------------

Prd
p_makat name
1 aaa
2 bbb
3 ddd

tbl
P_makat Set_no
1 4
2 3


--------------------------------------------------------------------------------



this is the result



quote:
--------------------------------------------------------------------------------

P_makat Set_no
1 4
2 3
3 NULL

--------------------------------------------------------------------------------



2 questions :
1)how can i get the result from the first 2 tables?
2)how can i get for example the result of p_makat=3
from table 1 even if it dosent exist in table 2?
so i will see al table 1 detailes and from table 2 i will see that the valu dosent ecist?
thanks in advane
peleg

Posted: Tue Dec 07, 2004 5:23 am
by []InTeR[]
I think this will work:

Code: Select all

SELECT
  prd.p_makat,
  tbl.set_no
FROM prd
LEFT JOIN tbl ON tbl.p_makat = prd.p_makat

i added w where and it didnt help :

Posted: Tue Dec 07, 2004 9:11 am
by pelegk2
i did L:

Code: Select all

SELECT
  common.products.p_makat, 
  tblweightstations.set_no 
FROM common.products 
LEFT JOIN tblweightstations ON tblweightstations.p_makat = common.products.p_makat  where tblweightstations.p_makat='6502'

opppsssssory it workd great now:)
thanks *1000000000000000000000$

Posted: Tue Dec 07, 2004 9:16 am
by []InTeR[]
You'r wellcome