Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB SQL » View Thread |
Messages 1 to 4 of 4 total |
Include ROW only if SUM field is NOT 0.00 |
Tue, May 29 2012 1:40 AM | Permanent Link |
IQA | Hi Tim & Team,
Might be a simple one... Is it possible in SQL to ONLY include a row in the result set IF a SUM field is NOT 0.00 I'm producing a debtors report and I have "SUM(trans_total) AS balance" and I only want to have the row in the result set IF the balance is NOT 0.00 Cheers, Phil. |
Tue, May 29 2012 2:59 AM | Permanent Link |
Uli Becker | Phil,
> Is it possible in SQL to ONLY include a row in the result set IF a SUM > field is NOT 0.00 > > I'm producing a debtors report and I have "SUM(trans_total) AS balance" > and I only want to have the row in the result set IF the balance is NOT > 0.00 select sum(trans_total) as balance from Invoices Having balance > 0 should work (untested) Regars Uli |
Tue, May 29 2012 6:13 AM | Permanent Link |
IQA | Thanks for the input Uli... However I'm not sure of the placement as of
the 'HAVING balance <> 0' as its used in JOIN... Any ideas? SELECT ALL "company"."comp_name" AS "comp_name", "company"."city" AS "city", "company"."state" AS "state", "company"."companyemail" AS "companyemail", SUM("trans_total") AS "balance" FROM "company" LEFT OUTER JOIN "guest" ON "company"."companyID" = "guest"."companyID" LEFT OUTER JOIN "trans" ON "guest"."res_num" = "trans"."res_num" WHERE "voidID" IS NULL AND "status" = 40 GROUP BY "companyID" ORDER BY "company"."comp_name", "familyname" |
Tue, May 29 2012 6:15 AM | Permanent Link |
IQA | It's ok I worked it out thanks again
|
This web page was last updated on Sunday, May 5, 2024 at 10:18 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |