Need resolution for a SQL in General reports Manager

Page 1 of 1
3 posts
Need resolution for a SQL in General reports Manager

Vara
New MMEX User

Posts: 6
Joined: Wed Mar 23, 2016 11:19 pm
I am trying to write a SQL that shows information from the budget table and checking account table so that I can view the following

Categid,  Categname,  Subcategid ,Subcategname, Absolute amount (from the budget table), sum(transamount) from the Checking account table and exclude subcategid '98' and '99.
This is the query I wrote but am getting a syntax error. Could someone help me please?

Code: Select all
SELECT  c.categname,  sc.subcategname, ABS(b.amount) as Budget, subquery1.Actuals 
FROM budgettable_v1 b, (SELECT a.categid categ, a.subcategid subcateg, SUM(a.transamount) as Actuals  from checkingaccount_v1 a  where subcateg not in (‘98’,’99’) group by categ,subcateg) subquery1,  category_v1 c, subcategory_v1 sc
WHERE subquery1.categ = b.categid  and subquery1.subcateg = b.subcategid  and c.categid = b.categid and sc.subcategid = b.subcategid
GROUP BY b.categid, b.subcategid
ORDER BY b.categid, b.subcategid;
Re: Need resolution for a SQL in General reports Manager

Nikolay
MMEX Developer

Posts: 2284
Joined: Sat Dec 06, 2008 8:27 am
Location: Sankt-Petersburg, Russia
It's working for me
Code: Select all
SELECT  c.categname,  sc.subcategname, ABS(b.amount) as Budget, subquery1.Actuals 
FROM budgettable_v1 b
, (SELECT a.categid categ, a.subcategid subcateg, SUM(a.transamount) as Actuals  from checkingaccount_v1 a  where subcateg not in ('98','99') group by categ,subcateg) subquery1
,  category_v1 c, subcategory_v1 sc
WHERE subquery1.categ = b.categid  and subquery1.subcateg = b.subcategid  and c.categid = b.categid and sc.subcategid = b.subcategid
GROUP BY b.categid, b.subcategid
ORDER BY b.categid, b.subcategid;
Re: Need resolution for a SQL in General reports Manager

Vara
New MMEX User

Posts: 6
Joined: Wed Mar 23, 2016 11:19 pm
Thanks I got it working.

This query can be closed
Page 1 of 1
Who is online

Users browsing this forum: No registered users and 14 guests

cron