Article View: borland.public.interbase.sql
Article #67can I do that with one select statement
From: Isaac
Date: Tue, 27 May 2008 08:46
Date: Tue, 27 May 2008 08:46
19 lines
1249 bytes
1249 bytes
Hello, I need to to sum a field and store the result into a variable in a stored procedure, can I use one select statement to get the sum based on a condition from another field ex sum(field_a) when field_b = 1 sum(field_a) when field_b = 0 field_a field_b 5 1 10 0 52 1 or I have to use two select ? sorry this may appear stupid but I am asking to improve performance Thanks
Technical Details
Message-ID:
<483bca8e@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,e4861ce108d51b43,start X-Google-Attributes: gid114a0e,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Date: Tue, 27 May 2008 11:46:58 +0300 From: Isaac <no@no.com> User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) MIME-Version: 1.0 Newsgroups: borland.public.interbase.sql Subject: can I do that with one select statement Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 41.234.199.170 Message-ID: <483bca8e@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1211878030 41.234.199.170 (27 May 2008 01:47:10 -0700) Lines: 19 Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail