question

Gogolo avatar image
Gogolo asked

Select value from table, find information between in another table

I need to find information on second table, where the selected value from first table belong. In second table are stored only starting serial number and ending serial number. example: SELECT num1 FROM tbl1 WHERE num1 IN ( SELECT * FROM tbl2 WHERE num1 BETWEEN firstSerialNo AND lastSerialNo )
selectsql server 2008 r2between
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

seanlange avatar image seanlange commented ·
As posted there is not a lot of chance for people to answer this. Can you provide some details about what you are trying to do?
0 Likes 0 ·

1 Answer

·
GPO avatar image
GPO answered
(making a lot of assumptions here, but I hope I can get you started nevertheless) What about: SELECT tbl1.num1 ,tbl2.firstSerialNo ,tbl2.lastSerialNo FROM tbl1 LEFT JOIN tbl2 ON tbl1.num1 between tbl2.firstSerialNo AND tbl2.lastSerialNo ;
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.