Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Ashy Larry
Starting Member
2 Posts |
Posted - 2009-02-13 : 16:37:09
|
| I have to modify one of our existing reports.The way this current report is set up there are three seperate SQL queries that have a union staement in between each of these queries. This joins all three tables together to give me 1746 rows.The new modification forces me to create sub tables using the "into" statement. Then eventually left joining the two tables into one table. For each of the three queries I would be creating 2 tables.When I try to run my query I get the error message of being allowed to only use the into statement prior to the union statement.Is there any type of work around to get my tables.I tried joining all the tables but it limits the size of the column to the size of the first table. Which is 295 rows. 3*295 = 885. About half the rows I need.I using Crystal to display my report. My only thought it to create two other sub reports with the same format so they look like the same report. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-02-14 : 00:58:51
|
| you may sound more clearer if you explain this with some data. as of currently given info, try as Tara suggested. if still it does work,please provide some sample data and explain what you want |
 |
|
|
Ashy Larry
Starting Member
2 Posts |
Posted - 2009-02-17 : 10:17:41
|
| Ok, here is a little more information.Currently how my query is set up is as follows..select stuff from table unionselect stuff from table union select stuff from table But the new code I have put together relys on "select stuff from table" becoming...select stuff into #Afrom tableselect stuffinto #Bfrom tableSelect * from #A, #BIs there any way to union the above from three different tables?An axample of this would be...select stuff into #Afrom tableselect stuffinto #Bfrom tableSelect * from #A, #Bunionselect stuff into #Cfrom tableselect stuffinto #Dfrom tableSelect * from #C, #Dunionselect stuff into #Efrom tableselect stuffinto #Ffrom tableSelect * from #E, #FCan I union the select for each of the A and B, then C and D, and then E and F? |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-02-17 : 10:28:17
|
| you can do thisSelect * from #A, #BunionSelect * from #C, #DunionSelect * from #E, #F |
 |
|
|
|
|
|
|
|