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 |
jocast
Starting Member
8 Posts |
Posted - 2010-08-30 : 20:15:10
|
Hello forumI have a problem. I have two tablesTableARef | PN |Partqty | PriceAAA 123 10 12.00AAA abc 8 15.00AAA 023 11 8.00Table BRef |setqty | typeAAA 2 BoxAAA 1 PalletI need this resultRef | PN |Partqty | Price|setqty |typeAAA 123 10 12.00 2 BoxAAA abc 8 15.00 1 PalletAAA 023 11 8.00Right now i am geting 9 rows each partnumber with each type.Is there a way to do this???Thank you |
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2010-08-30 : 22:30:40
|
You would need to explain more. I don't understand the logic you have going to arrive at the output. Also, What do you mean by 'uneven data'? |
 |
|
jocast
Starting Member
8 Posts |
Posted - 2010-08-31 : 10:21:34
|
I mean that it will not fill all the part numbers with data i the setqty and type of box |
 |
|
jocast
Starting Member
8 Posts |
Posted - 2010-09-01 : 16:51:45
|
Anyone??? |
 |
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2010-09-01 : 17:04:40
|
You need to change your query.CODO ERGO SUM |
 |
|
glendcruz
Yak Posting Veteran
60 Posts |
Posted - 2010-09-01 : 20:10:05
|
I have been trying this out, but cannnot get anywhere. It lacks clarity. Could you explain it more clearly. |
 |
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2010-09-01 : 22:09:14
|
Your explanation lacks clarity as well. How are you getting at setqty and type from table B and associating that with table A? |
 |
|
PavanKK
Starting Member
32 Posts |
Posted - 2010-09-02 : 04:29:22
|
Based on the displyed Data & required output, the following query is designed. I am not sure how it will help with your exact requirement.As Saket said provide more details to help you better.SELECT IDENTITY(INT,1,1) AS SNo,* INTO #TableA FROM TableASELECT IDENTITY(INT,1,1) AS SNo,* INTO #TableB FROM TableBSELECT A.Ref,A.PN,A.Partqty,A.Price,B.setqty,B.typeFROM #TableA ALEFT JOIN #TableB B ON A.SNo = B.SNoDROP TABLE #TableADROP TABLE #TableBKK |
 |
|
|
|
|
|
|