MySQL Forums
Forum List  »  Microsoft Access

Re: sql from access-pls analyze this error
Posted by: sunil kattathara
Date: July 07, 2006 08:42AM

Thank you Bob,
i am trying to analyze your sql advice

SELECT d.OrderID, d.DateSold, d.SalePrice, q.Referedby1, d.SalePrice*0.04 AS ReferredBy1Comm
FROM OrderDetails AS d
JOIN Query1 AS q ON OrderDetails.ContactAutoID = Query1.ContactAutoID
WHERE q.Referedby1 IS NOT NULL
AND q.Referedby1>0;

was actually very much confused since the query you corrected is derived from Query1 and it was working!

sql of Query1

SELECT Table1.ContactAutoID, Table1.Referedby AS Referedby1, Table1_1.Referedby AS Referedby2, Table1_2.Referedby AS Referedby3
FROM (Table1 LEFT JOIN Table1 AS Table1_1 ON Table1.Referedby = Table1_1.ContactAutoID) LEFT JOIN Table1 AS Table1_2 ON Table1_1.Referedby = Table1_2.ContactAutoID;

this was directly copied from access sql window to sql window of phpmyadmin
fortunatly i got a good output
of course as you mentioned, there is no [ ] in this...may be that's why it worked.
the angle of approach too seems different...
could you re-format Query1 too, though its working a comparative study will be a good learning experience.
thank you once again Bob
sunil

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: sql from access-pls analyze this error
1513
July 07, 2006 08:42AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.