By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
460,044 Members | 1,377 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 460,044 IT Pros & Developers. It's quick & easy.

error in running the join query

P: 40
Hi!
i am facing a probleum while excuting the query having join operator
i am using sql server 6.0 and my query is

Select BABLU.COM_NAME,BABLU.INDNT,VEER.ADDRESS From BABLU Join VEER on BABLU.COM_NAME = VEER.COM_NAME
Feb 25 '08 #1
Share this Question
Share on Google+
14 Replies


radcaesar
Expert 100+
P: 759
What is the error u r getin ?
Feb 25 '08 #2

P: 40
Hi
THIS IS THE ERROR " SYNTAX ERROR NEAR VEER"




What is the error u r getin ?
Feb 26 '08 #3

ck9663
Expert 2.5K+
P: 2,878
Try specifying if you want an INNER, LEFT or RIGHT join...

-- CK
Feb 26 '08 #4

P: 40
HI!
NO ONE EXECUTED CORRECTLY, EVERY JOIN WHETHER IT IS INNER JOIN ,LEFT OR RIGHT JOIN
PLEASE PROVIDE SOME HELP



Try specifying if you want an INNER, LEFT or RIGHT join...

-- CK
Feb 26 '08 #5

ck9663
Expert 2.5K+
P: 2,878
Please provide more info.

Paste same sample rows (it does not have to be the actual data) here and the query what you have so far.

-- CK
Feb 26 '08 #6

P: 40
Hi!
i have two tables customer and sales in both tables "cus_id " column name is common and i am using the query

SELECT CUSTOMER.FIRST_NAME,CUSTOMER.LAST_NAME,SALES.DATE FROM CUSTOMER LEFT OUTER JOIN SALES
ON CUSTOMER.CUS_ID = SALES.CUS_ID
i want to get all the rows from customer tables and some from sales which matched in both tables

with regareds
varinder



Please provide more info.

Paste same sample rows (it does not have to be the actual data) here and the query what you have so far.

-- CK
Feb 27 '08 #7

ck9663
Expert 2.5K+
P: 2,878
What error are you getting?

-- CK
Feb 27 '08 #8

P: 40
SYNTAX ERROR NEAR JOIN
BUT I AM NOT GETTING WHAT IS WRONG IN MY CODE



What error are you getting?

-- CK
Feb 27 '08 #9

P: 92
Have you tried using aliases?

SELECT C.FIRST_NAME,C.LAST_NAME,S.DATE FROM CUSTOMER C LEFT OUTER JOIN SALES S
ON C.CUS_ID = S.CUS_ID

And if you'd like to get only the rows that has the same CUS_ID from both tables then you might want to use INNER JOIN.
Feb 27 '08 #10

P: 40
Hi
THIS QUERY IS ALSO SHOWING THE SAME ERROR
"INCORRECT SYNTAX NEAR LEFT"


Have you tried using aliases?

SELECT C.FIRST_NAME,C.LAST_NAME,S.DATE FROM CUSTOMER C LEFT OUTER JOIN SALES S
ON C.CUS_ID = S.CUS_ID

And if you'd like to get only the rows that has the same CUS_ID from both tables then you might want to use INNER JOIN.
Feb 27 '08 #11

ck9663
Expert 2.5K+
P: 2,878
Where are you running this?

-- CK
Feb 27 '08 #12

P: 40
Hi!
I AM RUNNING THIS QUERY IN SQL SERVER 6.0 QUERY ANALYZER


Where are you running this?

-- CK
Feb 27 '08 #13

ck9663
Expert 2.5K+
P: 2,878
Hi!
I AM RUNNING THIS QUERY IN SQL SERVER 6.0 QUERY ANALYZER
The query seems to be correct...


Expand|Select|Wrap|Line Numbers
  1. SELECT C.FIRST_NAME,C.LAST_NAME,S.DATE 
  2. FROM CUSTOMER C 
  3. LEFT OUTER SALES S ON C.CUS_ID = S.CUS_ID
-- CK
Feb 27 '08 #14

P: 92
I don't know if SQL Server 6.0 can support Join statements.. I don't have version 6.0 here.

You may code it differently, like:

SELECT CUSTOMER.FIRST_NAME, CUSTOMER.LAST_NAME, SALES.DATE
FROM CUSTOMER, SALES
WHERE CUSTOMER.CUS_ID = SALES.CUS_ID

The difference of that query from the query with Join statement is that Join statement could retrieve data faster.
Feb 27 '08 #15

Post your reply

Sign in to post your reply or Sign up for a free account.