Hi,

I have 2 tables as follows:

table 1 contains code,order_qty
table 2 contains code,stock_qty

table 1:

code1, 10
code2, 2
code3, 5

table 2:

code1, 3
code3, 5
code1, 4
code3, 2


I need to see the following result:

code  | order_qty| stock_qty
code1 | 10       | 7
code2 | 2        | 0

The condition is : order_qty >sum(stock_qty) and note that if code is not found in table2, stock_qty is 0.

Can this be achieved with a single select query? or suggest the best option.

Thanks.


Veln




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to