Re: SQL problem
Posted in 2000
This is a multi-part message in MIME format. --------------EC8CE99C2B35E079086FC43B Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Graeme try this Assuming you have Informix 7.31: select (sum(case when stockhash = "AAAACV" and inoutind = "+" then qty end )- sum(case when stockhash = "AAAACV" and inoutind = "-" then qty end )) from st_stmove Graeme Muirhead wrote: > Can anyone suggest a syntax equivalent to the following but avoiding > temporary tables: > > select sum(qty) plus from st_stmove > where stockhash = "AAAACV" and inoutind = "+" > into temp a; > > select sum(qty) minus from st_stmove > where stockhash = "AAAACV" and inoutind = "-" > into temp b; > > select sum(plus - minus) from a, b > > Thanks. > > Graeme Muirhead > g.muirhead@freeuk.com --------------EC8CE99C2B35E079086FC43B Content-Type: text/x-vcard; charset=us-ascii; name="NVIRK.vcf" Content-Transfer-Encoding: 7bit Content-Description: Card for Navdeep Singh Virk Content-Disposition: attachment; filename="NVIRK.vcf" begin:vcard n:Virk;Navdeep tel;home:(248)427-0785 tel;work:(734)524-5600 Extn. 6594 x-mozilla-html:FALSE adr:;;;;;; version:2.1 fn:Navdeep Virk end:vcard --------------EC8CE99C2B35E079086FC43B--