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

Try a Inner Join like this.

SELECT TABLE1.FIELD1, TABLE1.FIELD2
FROM TABLE1 INNER JOIN TABLE2 ON TABLE1.FIELD3 = TABLE2.FIELD3
WHERE TABLE2.FIELD4 BETWEEN 'A1' AND 'A50'
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.