all groups > sql server reporting services > september 2007 >
You're in the

sql server reporting services

group:

DataSet . . .?


DataSet . . .? GGill
9/6/2007 6:06:00 PM
sql server reporting services: For the my report in dataset i am using union. For example:

select * from tblOne
Union All
select * from tblTwo
Union All
select * from tblThree
Union All
select * from tblFour

But when i view the report it shows in different group order

select * from tblOne
Union All
select * from tblTwo
Union All
select * from tblFour
Union All
select * from tblThree

What do i need to do, so the way i wrote the code that i would like to see
groups?
Each select statement has column with group name.

Re: DataSet . . .? Jeje
9/6/2007 10:05:50 PM
something like: (?)
select 'one' as GroupName, * from tblOne
Union All
select 'two' as GroupName, * from tblTwo
Union All
select 'four' as GroupName, * from tblFour
Union All
select 'three' as GroupName, * from tblThree


[quoted text, click to view]
Re: DataSet . . .? GGill
9/7/2007 9:28:03 AM
I do not have GroupName column with one, two . . .
What i am looking for is show data the way i wrote the code. Each select, in
this case i have four has product name. So i would like to show way is in
dataset.

[quoted text, click to view]
Re: DataSet . . .? Michael C
9/7/2007 3:20:00 PM
GGill,
I think it is obvious that 'the way you wrote the code' is not going to
give you the answer you want. What JeJe was suggesting was to simply add a
user defined expression to each SELECT statement to make it sort the way you
want. Such as :

SELECT '1' as SortOrder, table1.* FROM table1
UNION ALL
SELECT '2' as SortOrder, table2.* FROM table2
UNION ALL
SELECT '3' as SortOrder, table3.* FROM table3
ORDER BY SortOrder

the field "SortOrder" doesn't need to be in your table..it is an expression.

Michael C


[quoted text, click to view]
AddThis Social Bookmark Button