June 29, 2012

Example of join table with subquery result in sql

Following is example that how to join table in sql using select query to retrieve rows from both tables.

select * from  First_table as T1 ,Second_table as T2  where T1.wono=T2.wono
and T1.id = (select top(1) id from   First_table as T1)

In above query T1 is alias name of first table and T2 is alias name for second table. Wono is primary column which used to join both table. It also example of sub query.

No comments:

Post a Comment