If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > ASP.NET SQL LEFT JOIN error

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-22-03, 09:54
DMac DMac is offline
Registered User
 
Join Date: Aug 2003
Posts: 8
ASP.NET SQL LEFT JOIN error

Hi,
got a problem with an ASP.NET (vbscript) page thats driving me mad!

My SQL query is:

SELECT TOP 100 person.first_name, person.last_name, person_type.type FROM person LEFT JOIN person_type ON person.person_ref = person_type.person_ref ORDER BY last_name

it was a lot more complex but i simplfied it down to just one join to try and figure the problem, which is that it causes this error....

Exception Details: Microsoft.Data.Odbc.OdbcException: ERROR [42000] [Sybase][ODBC Driver][Adaptive Server Anywhere]Syntax error or access violation: near 'JOIN' in ...FROM person LEFT [JOIN] (person_type ON...

Ive pasted the query into access and it works fine and if I replace the LEFT for INNER it also works fine.


Any suggestions would be much appriciated as its driving me crazy!


D
Reply With Quote
  #2 (permalink)  
Old 08-23-03, 15:19
unatratnag unatratnag is offline
Registered User
 
Join Date: Jul 2003
Location: Ohio/Chicago
Posts: 75
joins will be different upon which DB you're using
Code:
select select_list 
from table1 {left | right} [ outer] join
        table2
on  predicate 
 [ join restriction]
For example:

Code:
select au_fname, au_lname,  pub_name
from authors left join publishers
on  authors.city = publishers.city
Reply With Quote
  #3 (permalink)  
Old 08-27-03, 04:59
DMac DMac is offline
Registered User
 
Join Date: Aug 2003
Posts: 8
So you mean the syntax for doing a join on a sybase db will be different than for doing it in access?
Reply With Quote
  #4 (permalink)  
Old 08-27-03, 09:49
unatratnag unatratnag is offline
Registered User
 
Join Date: Jul 2003
Location: Ohio/Chicago
Posts: 75
possibly, i try to avoid access like the plague, but left/right join's can be a pain because they tend to differ langauge to language, does anyone know if there's a SQL standard way?
Reply With Quote
  #5 (permalink)  
Old 08-28-03, 08:30
DMac DMac is offline
Registered User
 
Join Date: Aug 2003
Posts: 8
Might be some use to someone in future so....

I eventually found out that all i needed to do was add OUTER in between in LEFT and JOIN
Reply With Quote
  #6 (permalink)  
Old 08-28-03, 11:04
unatratnag unatratnag is offline
Registered User
 
Join Date: Jul 2003
Location: Ohio/Chicago
Posts: 75
or you could have read my first post and seen the outer keyword there =P
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On