Hi geeks,

I really need your help. I want to query in a table in MS SQL using a data in another table.
This might give you an idea on what I am talking about. This is the query I've constructed : "SELECT TABLE1.FIELD1,TABLE1.FIELD2 FROM TABLE1, TABLE2
WHERE TABLE1.FIELD3 = (SELECT TABLE2.FIELD3 FROM TABLE2
WHERE TABLE2.FIELD4 BETWEEN 'A1' AND 'A50')".

Please guys reply...I experimented a lot but still unsuccessful.

Thanks in advance...

WHchaz1027

SELECT field1, field2
FROM table1
WHERE field3 IN (
  SELECT field3 
  FROM table2
  WHERE field4 BETWEEN 'A1' AND 'A50'
)

Thanks Man...

Your code is right. At last, Now I can proceed to the next level. Thanks again man..I owe you this.

WHchaz1027

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.