View Single Post
  #4  
Old May 28th, 2010, 10:15 PM posted to microsoft.public.access.queries
KenSheridan via AccessMonster.com
external usenet poster
 
Posts: 1,610
Default Query SQL Syntax

Do you really need to use a subquery here? As you are simply returning the
Business Phone value from Contacts Extended where the Contact Name value
matches the DPM value in Target_Stores_MRRS_Extended I'd have thought you
could have joined Contacts Extended to Target_Stores_MRRS_Extended on these
columns and return the Business Phone value in a column.

If there might be rows in Contacts Extended with no matches in
Target_Stores_MRRS_Extended the join would need to be a LEFT OUTER JOIN.

A join will also generally be a lot faster than a correlated subquery.

Ken Sheridan
Stafford, England

Rob Hamlin wrote:
I have 2 queries that I am building another query off of.

I have on query with the name of project contacts in it.

I have another query with all the associated contact info in it.

I made a cutom colum in the query and used this syntax.
DPM PhoneSelect [Business Phone] FROM [Contacts Extended] Where [Contacts
Extended]![Contact Name]=[Target_Stores_MRRS_Extended]![DPM])

This is not working. Can anyone help or point me to a good resource for how
to use the syntax correctly.

Thanks,


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...eries/201005/1