﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / General / SQL Server 7,2000  / Two query results mixed together / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Wed, 19 Jun 2013 02:26:18 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Two query results mixed together</title><link>http://www.sqlservercentral.com/Forums/Topic707679-9-1.aspx</link><description>You could add a "sort" column to your temporary table - like an Identity column that simply generates a sequential number, incremented for each row inserted into the table.You can then use ORDER BY when querying from the temp table, which should give you the result you are after.</description><pubDate>Tue, 05 May 2009 13:52:55 GMT</pubDate><dc:creator>Naked Ape</dc:creator></item><item><title>RE: Two query results mixed together</title><link>http://www.sqlservercentral.com/Forums/Topic707679-9-1.aspx</link><description>Are you trying to get 3 different result sets with the queries? OrOne table with the results from 3 different queries in it?</description><pubDate>Tue, 05 May 2009 09:26:56 GMT</pubDate><dc:creator>David Lester</dc:creator></item><item><title>RE: Two query results mixed together</title><link>http://www.sqlservercentral.com/Forums/Topic707679-9-1.aspx</link><description>If you want the rows from a query to be returned in any specific order then you must specify the ORDER BY clause. For e.g.SELECT * FROM SomeTempTable ORDER BY SomeKey</description><pubDate>Mon, 04 May 2009 03:45:57 GMT</pubDate><dc:creator>Ramesh Saive</dc:creator></item><item><title>RE: Two query results mixed together</title><link>http://www.sqlservercentral.com/Forums/Topic707679-9-1.aspx</link><description>Hi , It means that when i select the list from temp table i found that few records of 1 query get display with the records of 3 query.Ex . if 1 query returns 50 rows and and 3 query returns 20 rows then ... while reviewing the result set from temp table ... i see 45 records from 1 query and 25 records from 3 query. As i have put some spaces between the queries so that it can be easily understood the result set of all 3 different queries...I hope this time i had explained properly...Regards,Vizay</description><pubDate>Thu, 30 Apr 2009 23:49:34 GMT</pubDate><dc:creator>k.vizay</dc:creator></item><item><title>RE: Two query results mixed together</title><link>http://www.sqlservercentral.com/Forums/Topic707679-9-1.aspx</link><description>I don't think I understood very well, can explain us what do you mean by "the results of one query gets clubbed with another query"?  How about adding some sample data with the generated output for the sample data?</description><pubDate>Thu, 30 Apr 2009 08:19:30 GMT</pubDate><dc:creator>Ramesh Saive</dc:creator></item><item><title>Two query results mixed together</title><link>http://www.sqlservercentral.com/Forums/Topic707679-9-1.aspx</link><description>Dear All,I am facing a very strange problem and i would highly appreciate if some one can help me.i have 3 query and their results inserting into a temp table but the results of one query gets clubbed with another query.Ex. 1 Query . insert into temp select top 2 * from table (5 columns)        Query . insert into temp values('','','','','')     [extra line break for visibility]          2 Query . insert into temp select top 2 * from table1 (5 columns)        Query . insert into temp values('','','','','')      [extra line break for visibility]     3 Query . insert into temp select top 2 * from table (5 columns)Now few reocrds of query 1 result gets merge with query 3 result.I am in dilemma why exactly it happens as i had tried delay for five seconds between each query.Please suggest me to sort out this issue.Thanks in Advance.Vizay</description><pubDate>Thu, 30 Apr 2009 07:40:14 GMT</pubDate><dc:creator>k.vizay</dc:creator></item></channel></rss>