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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SELECT AS

Status
Not open for further replies.

johnny45

Technical User
Nov 8, 2006
136
CA
There are 2 tables...one table contains the field descriptions and another contains the values:

SELECT CSOPTFH.FDESC
FROM CSOPTFH
WHERE (((CSOPTFH.OPTFIELD)="105"));

will give me the column HEADING

and

SELECT CSOPTFD.VDESC
FROM CSOPTFD
WHERE (((CSOPTFD.OPTFIELD)="105"));

will give me the values
Can I combine both so that the 1st select can be the column HEADING for the 2nd selct statement ?
 
Something like this should work:
SELECT CSOPTFH.FDESC as "Heading", CSOPTFD.VDESC as "Value"
FROM CSOPTFH, CSOPTFD
WHERE CSOPTFH.OPTFIELD = '105' and CSOPTFD.OPTFIELD = '105'



Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
 
Thanks Mirtheil,
I must have explained wrong.....

I guess this will explain better:

SELECT CSOPTFD.VDESC AS[SELECT CSOPTFH.FDESC
FROM CSOPTFH
WHERE (((CSOPTFH.OPTFIELD)="105"));
]
FROM CSOPTFD
WHERE (((CSOPTFD.OPTFIELD)="105"));
 
No, I don't think that's possible.
You might be able to write a stored procedure and store the output of the first query into a variable and then use the variable as the column name in the second query. I haven't tried it though.

Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
 
Thanks for taking the time on this post :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top