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 |
|
praveeri
Starting Member
5 Posts |
Posted - 2010-06-26 : 05:40:51
|
| I have two tablesTabl1Date Product Price WithEfftTable2Date Product Price qty valuePrice in table2 is fetched from table1date column in table1 will always not equal to date column in table2I want to join both tables where date in table2 is greater than or equal to table1 and it should never be greater than the second occurance of the date in table1 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-06-26 : 06:36:07
|
It is always the same song.We need table structure and sample data and wanted output.Otherwise it is not easy to give a solution. No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
praveeri
Starting Member
5 Posts |
Posted - 2010-06-26 : 06:55:49
|
| thanks fred here is the detailsTable1 date product price withefft 01/06/2010 sss 500 01/06/2010 01/06/2010 ttt 625 01/06/2010 06/06/2010 sss 510 06/06/2010 06/06/2010 ttt 605 06/06/2010 Table2 Date product price qty value01/06/2010 sss 500 2 100001/06/2010 sss 500 3 150001/06/2010 ttt 625 1 62501/06/2010 ttt 625 1 62502/06/2010 sss 500 1 50002/06/2010 ttt 625 3 187505/06/2010 ttt 625 5 312506/06/2010 sss 510 5 2550 wanted result Date product price qty value table1.date table1.product table1.price table1.witheffct01/06/2010 sss 500 2 1000 01/06/2010 sss 500 01/06/201001/06/2010 sss 500 3 1500 01/06/2010 sss 500 01/06/201001/06/2010 ttt 625 1 625 01/06/2010 ttt 625 01/06/201001/06/2010 ttt 625 1 625 01/06/2010 ttt 625 01/06/201002/06/2010 sss 500 1 500 01/06/2010 sss 500 01/06/201002/06/2010 ttt 625 3 1875 01/06/2010 ttt 625 01/06/201005/06/2010 ttt 625 5 3125 01/06/2010 ttt 625 01/06/201006/06/2010 sss 510 5 2550 06/06/2010 sss 510 06/06/2010 |
 |
|
|
|
|
|