p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Classic ASP Basics (http://p2p.wrox.com/forumdisplay.php?f=61)
-   -   Joins error.... please help! (http://p2p.wrox.com/showthread.php?t=24966)

jaywhy13 February 2nd, 2005 08:52 PM

Joins error.... please help!
 
I get the following error for this code....
Please help:
============================
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'users.username=userPreferences.username INNER JOIN displayOptions ON userPreferences.displayID=displayOptions.displayID '.

And the error is on the line where i do this:
RS.Open sqlAuthenticate, Conn, 3, 3
My RS is defined eariler



Code:

sqlAuthenticate="SELECT userPreferences.msgSort, userPreferences.msgDirection,
users.username, users.password, users.picLocation, users.firstname FROM users
LEFT JOIN userPreferences ON users.username=userPreferences.username INNER JOIN
displayOptions on userPreferences.displayID = displayOptions.displayID
WHERE users.username='" & user & "' AND users.password='" & password & "'"

I'm gonna download the internet if its the last thing I do....
Until the algorithm is finished u must prepared to bow down and worship me (or my grave).... i figured i'll b finished b4 the latter!

om_prakash February 2nd, 2005 10:30 PM

can u response.write the SQL statement?

Also, please check for the Access driver as well. this might be an issue.

Om Prakash

mat41 February 2nd, 2005 10:53 PM

mmmm, I can not see a missing operator

Wind is your friend
Matt

ChrisScott February 3rd, 2005 05:02 AM

Looks like it might be access's love of brackets around various joins that's the problem, also I think it may complain when you try to do a left join before an outer join.
Give this a try...
Code:

sqlAuthenticate="SELECT userPreferences.msgSort, userPreferences.msgDirection,
users.username, users.password, users.picLocation, users.firstname FROM (users
LEFT JOIN userPreferences ON users.username=userPreferences.username) LEFT JOIN
displayOptions on userPreferences.displayID = displayOptions.displayID
WHERE users.username='" & user & "' AND users.password='" & password & "';"

HTH,

Chris


jaywhy13 February 3rd, 2005 09:12 AM

thanks! That worked.... I wanted to really use an INNER JOIN for the last one but the LEFT JOIN will work still because there are matchin records for all.... so it still acts like a INNER JOIN tho thanks!

I'm gonna download the internet if its the last thing I do....
Until the algorithm is finished u must prepared to bow down and worship me (or my grave).... i figured i'll b finished b4 the latter!


All times are GMT -4. The time now is 11:43 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.