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 |
|
u2p_inst
Yak Posting Veteran
78 Posts |
Posted - 2003-12-15 : 05:51:44
|
| i have 2 tables1st table:id | max | min | value|1 1 10 12 11 20 23 21 30 32nd table suchid| Number |1 82 143 25i need the result likecol1 | col2 | col3 1 8 1 2 14 2 3 25 3is it possible?How?oh |
|
|
Arnold Fribble
Yak-finder General
1961 Posts |
Posted - 2003-12-15 : 06:26:38
|
| It's not obvious from your question whether the values of col1 and col3 in the result are from Table1.id, Table1.Value or Table2.id.Assuming col1 is from Table2.id and col3 from Table1.Value, and that you really meant your 'max' values to be smaller than your 'min' values:SELECT Table2.id AS col1, Table2.Number AS col2, Table1.value AS col3FROM Table2INNER JOIN Table1 ON Table2.Number BETWEEN Table1."max" AND Table1."min" |
 |
|
|
u2p_inst
Yak Posting Veteran
78 Posts |
Posted - 2003-12-15 : 21:39:01
|
| thx arnold you're script working properly, but i have additional question now if the 2nd table(table2) have additional field let say value so if i input data to table2 then the field(value) automaticly insert data from lookup table(table1) so the result like you're scriptand value in table2 same with col3 in youre sql commandThxoh |
 |
|
|
u2p_inst
Yak Posting Veteran
78 Posts |
Posted - 2003-12-16 : 07:23:16
|
| is possible to create the automation using trigger?how?oh |
 |
|
|
|
|
|