SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SSRS - Report Builder 2.0 - SQL query generation - Order of fields dragged on the report changes the...


SSRS - Report Builder 2.0 - SQL query generation - Order of fields dragged on the report changes the generated query

Author
Message
Aedna
Aedna
Grasshopper
Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)

Group: General Forum Members
Points: 14 Visits: 62
say, I have 3 tables : Toys, Baby, Diapers.

one Baby can have zero or many Toys and zero or many Diapers as well. (Toy - M:1 - Baby - 1:M - Diaper)

now in the report I am trying to put together Count of Toys per Baby, showing also Diapers Descr, when available.

if I drag Baby Name first, then Diaper Descr and then right after that I drop Count of Toys - I get only result set for data with Diapers and Toys present, and data where Diapers=null is not in the report!

in the resulting query I get subselect A (Baby + Diaper) joined to subselect B (Baby + Toy) on Baby ID (which is OK) and Diaper Description!!! which is NOT OK, because all data about Toys for null Diapers gets cut off

if, however, I drag Diaper first, then Baby, then Count of Toys - I get full result set even for Babies without Diapers. In the resulting queries I have subselects too, but they are joined on BabyID only.

Why is the order of columns that we drag changes the query so drastically?

How can we control that?

(Note: Diapers and Toys are named queries which are full outer joined to Baby for all BabyIDs, so even if Baby doesn't have Diaper - there will be an entry in Diapers view with Diaper Descr = null)
wesley.boyd
wesley.boyd
SSC Rookie
SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)

Group: General Forum Members
Points: 28 Visits: 190
with a condom!
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search