Saturday, August 10, 2013

Use of Sub Query in Asp.Net

Sub Query

1)StateMaster Table

Column Name:-Id,State

2)CityMaster Table

Column Name:- Id,StateId,City

Question:- How to retrieve Column City,State from Table CityMaster,StateMaster respectively?

Answer:- select *,(select [State] from StateMaster where StateMaster.Id=StateId) as [State] from CityMaster 




No comments:

Post a Comment