Hi again thanks for quick reply,
I make this query but giving only single result instead of multiple should come,
Please check the query code
Select estimat_customer.order_no from estimat_customer
LEFT
JOIN prepress
ON prepress.order_no =estimat_customer.order_no IS NULL
LEFT
JOIN press
ON press.order_no = estimat_customer.order_no IS NULL
LEFT
JOIN postpress
ON postpress.order_no = estimat_customer.order_no IS NULL
LEFT
JOIN qc
ON qc.order_no = estimat_customer.order_no IS NULL
LEFT
JOIN binding
ON binding.order_no = estimat_customer.order_no IS NULL
LEFT
JOIN dispatch
ON dispatch.order_no = estimat_customer.order_no IS NULL
WHERE estimat_customer.order_no ='$order_num' order by order_no DESC";
what i want to achieve is
Table 1 have Order_no 2,4,6,7,8,9,5,1
And all 6 tables have order_no 4 in there column
so the result should be
Table 1- 2,6,7,8,9,5,1
Select estimat_customer.order_no from estimat_customer
LEFT OUTER
JOIN prepress
ON prepress.order_no =estimat_customer.order_no
LEFT OUTER
JOIN press
ON press.order_no = estimat_customer.order_no
LEFT OUTER
JOIN postpress
ON postpress.order_no = estimat_customer.order_no
LEFT OUTER
JOIN qc
ON qc.order_no = estimat_customer.order_no
LEFT OUTER
JOIN binding
ON binding.order_no = estimat_customer.order_no
LEFT OUTER
JOIN dispatch
ON dispatch.order_no = estimat_customer.order_no
WHERE estimat_customer.order_no ='$order_num' order by estimat_customer.order_no DESC";
Select estimat_customer.order_no from estimat_customer
LEFT OUTER
JOIN prepress
ON prepress.order_no =estimat_customer.order_no
LEFT OUTER
JOIN press
ON press.order_no = estimat_customer.order_no
LEFT OUTER
JOIN postpress
ON postpress.order_no = estimat_customer.order_no
LEFT OUTER
JOIN qc
ON qc.order_no = estimat_customer.order_no
LEFT OUTER
JOIN binding
ON binding.order_no = estimat_customer.order_no
LEFT OUTER
JOIN dispatch
ON dispatch.order_no = estimat_customer.order_no
WHERE estimat_customer.order_no ='$order_num' IS NULL order by estimat_customer.order_no DESC";
Select estimat_customer.order_no from estimat_customer
LEFT OUTER
JOIN prepress
ON prepress.order_no =estimat_customer.order_no IS NULL
LEFT OUTER
JOIN press
ON press.order_no = estimat_customer.order_no IS NULL
LEFT OUTER
JOIN postpress
ON postpress.order_no = estimat_customer.order_no IS NULL
LEFT OUTER
JOIN qc
ON qc.order_no = estimat_customer.order_no IS NULL
LEFT OUTER
JOIN binding
ON binding.order_no = estimat_customer.order_no IS NULL
LEFT OUTER
JOIN dispatch
ON dispatch.order_no = estimat_customer.order_no IS NULL
WHERE estimat_customer.order_no ='$order_num' order by estimat_customer.order_no DESC";
hi,
I use that too but giving only one value instead of multiple according to my current database setting.
please see post before this. (1st of above reply).
thanks
According the above code i create this but still no luck,
Select estimat_customer.order_no from estimat_customer
LEFT
JOIN prepress
ON prepress.order_no =estimat_customer.order_no where prepress.order_no IS NULL
LEFT
JOIN press
ON press.order_no = estimat_customer.order_no where press.order_no IS NULL
LEFT
JOIN postpress
ON postpress.order_no = estimat_customer.order_no where postpress.order_no IS NULL
LEFT
JOIN qc
ON qc.order_no = estimat_customer.order_no where qc.order_no IS NULL
LEFT
JOIN binding
ON binding.order_no = estimat_customer.order_no where binding.order_no IS NULL
LEFT
JOIN dispatch
ON dispatch.order_no = estimat_customer.order_no where dispatch.order_no IS NULL
WHERE estimat_customer.order_no ='$order_num' order by estimat_customer.order_no DESC";
Hi,
Please check #6 in which i put is NULL on the where clause, but you said that is also the wrong syntax,
then what is the right syntax?
What i think you are saying to do something like this
Select estimat_customer.order_no from estimat_customer
LEFT
JOIN prepress
ON prepress.order_no =estimat_customer.order_no
LEFT
JOIN press
ON press.order_no = estimat_customer.order_no
LEFT
JOIN postpress
ON postpress.order_no = estimat_customer.order_no
LEFT
JOIN qc
ON qc.order_no = estimat_customer.order_no
LEFT
JOIN binding
ON binding.order_no = estimat_customer.order_no
LEFT
JOIN dispatch
ON dispatch.order_no = estimat_customer.order_no
WHERE estimat_customer.order_no IS NULL order by estimat_customer.order_no DESC";
But also wouldn’t help because there must be a order no to match all queries that’s why i am putting " =‘$order_num’ " to check.
1- Yes i know there can be only one where clause but you saying every of my syntax is wrong that’s why i put those extra where clause.
2- Yes, i see the example but that is only for 2 tables and i have 6 that’s why the confusion is coming and rest i have one variable or a value to match that not present in example.
3- May be no, I haven’t use any of join query, i check several example and read theory but theory is my weak point and i usually do not under stand by that.
Sorry for inconvenience but i am not that good in MYSQL, and i haven’t use these queries in practical.
i would like you to please run the following query twice –
SELECT estimat_customer.order_no
, prepress.order_no
FROM estimat_customer
LEFT OUTER
JOIN prepress
ON prepress.order_no = estimat_customer.order_no
WHERE estimat_customer.order_no = '$order_num'
AND prepress.order_no IS NULL
run it once with the last line, and once without
examine the output in both cases, and then tell me what it’s doing
pick an $order_num that that exists in both tables, and the do it all again with an $order_num that exists only in the left table
hi,
This the case
Table estimate
order no
1,2,3,4,5,6
Table prepress
order no
1,2,3,4,5,6
Table Press
order no
1,2,3,4,5
table Postpress
order no
1,2,3,4
table qc
order no
1,2,3
table binding
order no
1,2
table dispatch
order no
1
Here only order no 1 present in all table, so the result should return
Order no
2,3,4,5,6 as per estimate table
thanks
Hi,
Solved.
i did some hit & trial then get this to full fill, what i am looking for.
Select estimat_customer.order_no from estimat_customer where estimat_customer.order_no NOT IN
(select prepress.order_no from prepress
join press ON press.order_no=prepress.order_no
join postpress ON postpress.order_no=prepress.order_no
join qc ON qc.order_no=prepress.order_no
join binding ON binding.order_no=prepress.order_no
join dispatch ON dispatch.order_no=prepress.order_no)