Pass thru - Select from two tables joined on three fields

G

Guest

In a Pass thru query, I want to select the meter_number, acct_period,
prod_period, dth from the dbo.con_vols table and the mcf and btu from the
dbo.meas table where the meter_number, acct_period and prod_period are equal
to the meter_number, acct_period and prod_period in the dbo.con_vols table.

Can anyone help, please? I know I need an INNER JOIN, but am not sure how
to do that.

Thank you in advance!
 
J

John W. Vinson

In a Pass thru query, I want to select the meter_number, acct_period,
prod_period, dth from the dbo.con_vols table and the mcf and btu from the
dbo.meas table where the meter_number, acct_period and prod_period are equal
to the meter_number, acct_period and prod_period in the dbo.con_vols table.

Can anyone help, please? I know I need an INNER JOIN, but am not sure how
to do that.

Thank you in advance!

SELECT dbo_con_vols.meter_number, dbo_con_vols.acct_period,
dbo_con_vols.prod_period, dbo_con_vols.dt,dbo_meas.mcf, dbo_meas.btu
FROM dbo_con_vols INNER JOIN dbo_meas
ON dbo_con_vols.meter_number = dbo_meas.meter_number
AND dbo_con_vols.acct_period = dbo_meas.acct_period
AND dbo_con_vols.prod_period = dbo_meas.prodt_period;

John W. Vinson [MVP]
 
G

Guest

Thank you, John!

John W. Vinson said:
SELECT dbo_con_vols.meter_number, dbo_con_vols.acct_period,
dbo_con_vols.prod_period, dbo_con_vols.dt,dbo_meas.mcf, dbo_meas.btu
FROM dbo_con_vols INNER JOIN dbo_meas
ON dbo_con_vols.meter_number = dbo_meas.meter_number
AND dbo_con_vols.acct_period = dbo_meas.acct_period
AND dbo_con_vols.prod_period = dbo_meas.prodt_period;

John W. Vinson [MVP]
 

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