How to make this query?

S

Su

Hello,

Got a question for the expert!

I got a table which like

BH Date Benzene Ethylene Xylene
BH1 ?? 1 2 3


How can I convert it to sth like this

BH Date Contaminant Result
BH1 ?? Benzene 1
BH1 ?? Ethylene 2
BH1 ?? Xylene 3

Many thanks!

Su
 
D

Duane Hookom

Your table is un-normalized which generally requires a Union query to
normalize:
SELECT BH, [Date] as ReadingDate, "Benzene" as Contaminant, [Benzene] as
Result
FROM tblA
UNION ALL
SELECT BH, [Date] , "Ethylene", [Ethylene]
FROM tblA
UNION ALL
SELECT BH, [Date] , "Xylene", [Xylene]
FROM tblA;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top