Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Executing subqueries

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
i've a subquery available as a sql string. The subquery will always return me a single value. How can i execute the subquery as part of a main query?
 
I'm not sure if I understand what you are asking, but if you have an SQL string "Select State from tblEmployees Where employeeID = 12345" then you could use this query, which returns the state where a specific employee lives in a query to get all employees who live in that state:

Select EmployeeID, EmployeeFirst, .....
From tblEmployee
Where state = ("Select State from tblEmployees Where employeeID = 12345")

I am doing this off the top of my head; I am in a really BAD training class so I don't have access to my own PC.

Hope this helps. Kathryn


 
select aaa,bbb,ccc,(select max(xxxx) from yyy t where yyy.ddd = t.ddd) from yyy John Fill
1c.bmp


ivfmd@mail.md
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top