I do not consider myself a complete newbie in SQL, but I have been looking at this problem for two days, on and off, and I'm starting to think, maybe I am!
Using the following two tables:
ID Category 1 Animal 2 Color 3 Sport Name ID Value Fred 1 Cat Fred 2 Blue Fred 3 Football Sally 1 Dog Sally 3 Jogging James 2 Green Anne 3 Swimming
I was unable to find any combination of group, sub-query, union, cte or pivot commands that will combine several rows returned from the query '(ID = 1 or ID = 2) into separate rows with several columns.
eg:.
where (ID=1 or ID=2) Name Animal Color Fred Cat Blue Sally Dog NULL James NULL Green
Can anyone advise me if there is an effective SQL solution for this or am I wasting my time on what should be processed by the code in the report?
thanks
source share