Re: items quantity

2006-02-02 Thread Peter Brawley
Gyurasits, >I have a query: >SELECT > i1.item_ID, > SUM(i1.quant) as Incoming, > SUM(IF(i2.quant is NULL, 0,i2.quant)) as Outgoing >FROM header h1 >INNER JOIN items i1 ON i1.header_ID=h1.id >LEFT JOIN header h2 ON h2.type_="2" >LEFT JOIN items i2 ON i2.header_ID=h2.id AND i1.item_ID=i2.item_

Re: items quantity

2006-02-02 Thread nigel wood
Gyurasits Zoltán wrote: Hi ALL! Please help DATA: header_iditem_idquant 1110 1220 21100 22200 3120 3215 "header" is the moving type, and "items" is the items table. If header.type_ is "1" then incoming move, if "2" o

items quantity

2006-02-02 Thread Gyurasits Zoltán
Hi ALL! Please help I have 2 tables... header -- id type_ DATA: --- id type_ 11 21 32 items -- header_id item_id quantity DATA: header_iditem_idquant 1110 1220 21100 22200 31