What select functions are available?

Forum for DBF Commander discussing.

What select functions are available?

Postby somethingsimil » Tue Jul 08, 2014 7:31 pm

I am testing to see if this product will do the reporting I need...

For example, I trying to use an IF/ELSE or DECODE function in the select list and then SUM() those rows. So, for example...

select brchs.brch,
jan_sum
from
(select distinct brch from "C:\TRANSACT.DBF" transdbf) brchs
left outer join (select brch, sum(IF(Ico="1AE",10, 25)) jan_sum from "C:\TRANSACT.DBF" where trans = "HON" and month ="B401" group by brch) jan on brchs.brch = jan.brch

Is this sort of select logic supported?
somethingsimil
 
Posts: 30
Joined: Tue Jul 08, 2014 6:05 pm

Re: What select functions are available?

Postby Admin » Tue Jul 08, 2014 9:13 pm

Yes, these constructions are supported, but you've a few syntax mistakes in your SQL. Here is corrected version:

Code: Select all
select brchs.brch, jan_sum
from
(select distinct brch from "C:\TRANSACT.DBF") AS brchs
left outer join
(select brch, sum(IIF(Ico="1AE",10, 25)) AS jan_sum from "C:\TRANSACT.DBF" where trans = "HON" and month ="B401" group by brch) AS jan
on brchs.brch = jan.brch

Additional info that can be useful for you:
IIF() function reference
JOIN conditions
Best regards,
Oleg Zhechkov
User avatar
Admin
Site Admin
 
Posts: 124
Joined: Wed Apr 21, 2010 7:27 pm


Return to DBF Commander Professional

Who is online

Users browsing this forum: No registered users and 5 guests

cron