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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Data retrieval

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-04-04 : 08:00:40
priya writes "I'm using SQL server 2000.I'm having 2 tables(Table1 and Table2).Table1(contains only 1 column) is getting created when i run some code from VB6.0.Rows of this table depends on some user input(so i can't fix it).Table2 contains some fields - specifically, all rows of the Table1 are columns here!(and contains some data).In any case rows of Table1 is a subset of columns of Table2.I want to retrieve data from Table2 based on rows of Table1 .How should i??
Let(for the time being) Table1 contains age and name as two records.
And Table2 contains age,name,address,designation as fields.
How should i get data corresponding to age and name field from Table2?"

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-04-04 : 08:52:52
Try this

Select T2.* from Table2 T2, Table1 T1 where T1.name=T2.name and T1.age=T2.age

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -