423,510 Members | 1,196 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 423,510 IT Pros & Developers. It's quick & easy.

query not working when i add an alias

P: n/a
a query is working at first,,then when i add an aliase to a table, it
doesnt work..this is using the SQL view for querying in MS Access 2002
(XP)........

for example

SELECT invoice_id, companies.name AS billing_company, total, date
FROM invoices INNER JOIN companies
ON invoices.billingcompany_id=companies.company_id

is working..but the following is not

SELECT invoice_id, companies.name AS billing_company, total, date
FROM invoices INNER JOIN companies AS C1
ON invoices.billingcompany_id=C1.company_id

access is giving me this error: Syntax error in JOIN operation. I am
new to SQL and even newer to Access.. can someone help?

Dec 25 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"sdot" <fl********@gmail.com> wrote in news:1135550670.035329.141090
@g43g2000cwa.googlegroups.com:
a query is working at first,,then when i add an aliase to a table, it
doesnt work..this is using the SQL view for querying in MS Access 2002
(XP)........

for example

SELECT invoice_id, companies.name AS billing_company, total, date
FROM invoices INNER JOIN companies
ON invoices.billingcompany_id=companies.company_id

is working..but the following is not

SELECT invoice_id, companies.name AS billing_company, total, date
FROM invoices INNER JOIN companies AS C1
ON invoices.billingcompany_id=C1.company_id

access is giving me this error: Syntax error in JOIN operation. I am
new to SQL and even newer to Access.. can someone help?


I think you'll need to alias the table all the places it's used, also in
the select clause

SELECT invoice_id, C1.name AS billing_company, total, date
FROM invoices INNER JOIN companies AS C1
ON invoices.billingcompany_id=C1.company_id

I would also recommend avoiding reserved words as names of fields (name,
date) ...
--
Roy-Vidar
Dec 25 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.