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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Does Access do subqueries in 'real' SQL? 1

Status
Not open for further replies.

JonesMone

Programmer
Mar 11, 2002
10
0
0
GB
I have found using simple queries in Access, then using a final query to pull the data together the only way to solve some problems. But how can this be represented in SQL for outside access without using a stored query?

the SQL that Access shows wont work, because the named queries take parameters themselves.

looks like a classic sql subquery to me, but i cant get access sql to use such a construction.

if you're still reading, the main use is to extract a stock list name of all parts of a certain type, then join this to another query which extracts a list of levels and other info from another table, but LEAVES BLANK the parts name lines which have no level info. i have not succeeded in convincing Access to do this, in one query.
 
Hello JonesMone,
Here are some subquery examples that work in Access 2000 & 2002. I can't remember if Access 97 supports these though -- I don't believe that it does.
Code:
SELECT tblStates.*, MySub.*
FROM tblStates LEFT JOIN (SELECT * FROM tblProvinces) AS MySub ON MySub.fldID = tblStates.fldID;
Or, using square brackets:
Code:
SELECT tblStates.*, MySub.*
FROM tblStates LEFT JOIN [SELECT * FROM tblProvinces]. AS MySub ON MySub.fldID = tblStates.fldID;
Hope that helps, Robert
•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•
Professional, affordable, Access database solutions and assistance °•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°
 
Thanks Robert

maybe ive been making this too hard.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top