mssql query modification

Last Post 20 Apr 2009 11:30 PM by SwePeso. 1 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
vinay789
New Member
New Member

--
18 Apr 2009 02:26 AM

Hi i am new bie to ms sql i want to place the data like this
for(int i=3;i<=5;i++)
{
select
adid,state,country
from
Tablei
}
Hi i want to place the data like this
Table1,Table2,Table3 tables i want to retrive data using select statement first i want to retrive data from Table1 after finishing Table1 now i want to retrive data for Table2 after combining Table1,Table2 i want to combine Table3 also so i think it is better to go with for loop Table1,Table2,Table3 contains similar fields.So no problem arises but it is not working any suggestions
SwePeso
New Member
New Member

--
20 Apr 2009 11:30 PM
SELECT adID,
State,
Country
FROM Table1

UNION ALL

SELECT adID,
State,
Country
FROM Table2

UNION ALL

SELECT adID,
State,
Country
FROM Table3

or use dynamic sql.
You are not authorized to post a reply.

Acceptable Use Policy