Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I need to query one table and add t

Status
Not open for further replies.

ntm0n

Programmer
Jun 22, 2001
30
US
I need to query one table and add the different select statements to a temp table.....

create table #temp(fy, parm1, parm2)

insert into #temp(fy,parm1,parm2)

and here is where I want to provide select statements as the input for the fields...ex:

select fy from tbl1 where..., select p1 from tbl1 where..., select p2 from tbl2 where.... etc......

Is this even possible? Can anyone lead me to some documention to read?

Thanks

Gary
 
Yes, but not like that... You need to JOIN your select statement somehow. With out knowing the layout of your tables, you would probably be best using the query designer, and dragging and dropping the fields you want, typing in the criteria, and copying and pasting the actualy generated SQL statement.

ex:
select tbl1.fy, tbl1.p1, tbl2.p2 from tbl1 inner join tbl2 on tbl1.ID=tbl2.ID where tbl1.criteria=true and tbl2.criteria=true
 
Thanks, I dont have much experience with the designer but I'll give it a try. The visual aspect of it may make it easier to visualize.

Gary
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top