Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
tirby
Starting Member
3 Posts |
Posted - 2009-04-20 : 13:07:27
|
I’m not sure how to use the join statement in this instance. I have been able to use vb2008 to get the data into data sets and process it from there but that used three separate sql queries and since I am working off satellite internet connections I need to watch the number of queriesI have two tables that I need to combine into a view.The first table is called inspectionLease Chemical Date levelWell1 Foamer 01/01/2009 48 Well1 SI 01/01/2009 57 Well2 SI 01/01/2009 36 Well1 Foamer 01/15/2009 45Well1 SI 01/15/2009 53Well2 SI 01/15/2009 32Well1 Foamer 01/30/2009 40Well1 SI 01/30/2009 50Well2 SI 01/30/2009 30The second table is called DeliveryLease Chemical Date AmountWell1 Foamer 01/13/2009 25Well1 SI 01/13/2009 20.What I need is a view that looks like thisLease Chemical Date1 Level Date 2 Level TotalDeliveredWell1 Foamer 1/01/2009 48 01/15/2009 45 25Well1 Foamer 1/15/2009 45 01/30/2009 40 0Well1 SI 1/01/2009 57 01/15/2009 53 20Well1 SI 1/15/2009 53 01/30/2009 50 0Well2 SI 1/01/2009 36 01/15/2009 32 0Well2 SI 1/15/2009 32 01/30/2009 30 0 |
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2009-04-20 : 13:47:15
|
USe Pivot or Crosstab queries. Search and you will find lot of them. |
 |
|
|
|
|