Question Locked

How to implement Query with in a Query?

0 helpful
4 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi every body.
I have a DB in which i am implementing a Query for Search. I am ok with it. after getting this result whatever the result of the search query is I want to further put a search criteria in the searched table.

but i can not do so. Can any one help me please.?

4 replies

by thumbsup2

The DB you're using makes a difference. Can you provide more details?

by khaksar_mkd

R. Sir, thx for ur time..

My DB is so simple I am making in Access using one table for a hospital Reception desk. It will store all the record of patient coming for check up.
Now one query i run serach by name for the record of a patient. but when the record appears there are so many patients of that name so i want to again put a search criteria in the Searched result such that i should get my goal.

Early responce is appreciated.
Regards,
Khaksar.

by tony hopkinson

Do you know both sets of query criteria before you start, if not you are probably going to shoot yourself in the foot.

You could create a temporray table, use
insert into mytemptable select * from Where
and then select from that.

If you want to show the inner guery results and then allow furtheer searching on it, it might be easier to do the thing in one go.

Or you do the rest of it client side, though that might a wee bit slow depending on how much data you have.

If you are trying for the accesss trick select * from query
ou can do
Select * from (some select query) dummyname where ...

which is basically all it does, not terribly efficient though.

Another thing you might want to look at is using views.

SQL Server 2005 also has a facility where you can put the inner query in a function and then select from that. (Table variables)

This discussion is closed to new replies.