Join queryies- urgent

S

subs

table A


carrier price year
op 3333 2009
ot 233 2009


table B


Carrier price year
op 1200 2008
op1 1400 2008


i need a query which can give me the following data( by combining the
tables)-


Carrier price for 2009 price for 2008
op 3333 1200
ot 233 -
op1 - 1400


Thanks for the help . Union queries donot work . Look at the format
that is required. i need a join SQl Query. When i left join the two
tables, it gives me the first two rows but not the last row. pls help
it is urgent

Thanks
 
M

MGFoster

subs said:
table A


carrier price year
op 3333 2009
ot 233 2009


table B


Carrier price year
op 1200 2008
op1 1400 2008


i need a query which can give me the following data( by combining the
tables)-


Carrier price for 2009 price for 2008
op 3333 1200
ot 233 -
op1 - 1400


Thanks for the help . Union queries donot work . Look at the format
that is required. i need a join SQl Query. When i left join the two
tables, it gives me the first two rows but not the last row. pls help
it is urgent

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Actually, a UNION will be needed, but wrapped in a cross-tab query:

TRANSFORM SUM(price) As theValue
SELECT carrier
FROM (
SELECT carrier, price, [year]
FROM tableA
UNION ALL
SELECT carrier, price, [year]
FROM tableB
) As A
GROUP BY carrier
PIVOT "price for " & [year]

HTH,
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSfkJ8YechKqOuFEgEQKVZQCfdHquGBeqdUWJg77htN5GsD6arswAoNfn
sD4kf87gT0B203fOZU6mnpMy
=cvug
-----END PGP SIGNATURE-----
 

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

Similar Threads

phone 1
JOins pls help 4
sql queries 3
access joins 1
table joins 2
joins pls help 1
SQL query urgent pls help 2
Linear Regresion. Sales By Year. 1

Top