Link to home
Start Free TrialLog in
Avatar of Roman F
Roman FFlag for United States of America

asked on

Please modify my exisitng query

I have a simple table tblMain
Title                       Count
Status One           2
Status Two          3
Status Three          1
so to get the select statement :)   you go
select * from tblMain

i want to modify the query and include the grandtotal also , so the results should be :

Title                       Count
Status One           2
Status Two          3
Status Three         1
Total                     6

it is simple to use two queries and then combine using union query
I need it as one query
Avatar of omgang
omgang
Flag of United States of America image

Select Title, [Status One], [Status Two], [Status Three], ([Status One] + [Status Two] + [Status Three]) As Total FROM tblMain

Is this what you want?
OM Gang
Avatar of Roman F

ASKER

i did not get,  no, i do not want that
what if i have fifty different statuses, ?
try this

select title,[count] from tblMain
union
select 'Total' as title, sum([count]) from tblMain
Avatar of Roman F

ASKER

That is what i was thinking, you use two queries and union them, I did that...
It is working...
is there just one select query?
You cannot get there from here.  - ie.  without using a union query ;-)
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial