Help with SQL Server 7, VB, and Inner Join 
Author Message
 Help with SQL Server 7, VB, and Inner Join

I am attempting to two tables within VB 6.0, adodb code :

sql = "Select a.one_field, b.two_field" & _
"FROM a_table" & _
"JOIN b_table" & _
"ON a.client_id = b.client_id and" & _
"a.card_type = b.card_type" & _

I get an any number of errors one of which says something to the effect that
my table name is not distinct enough.  This is a part of a much larger SQL
statement that works fine until I put this in.

Any suggestions,
Thanks ahead of time,
Keith



Sun, 30 Mar 2003 03:00:00 GMT  
 Help with SQL Server 7, VB, and Inner Join

you left out the alias:

FROM a_table AS a
JOIN b_table AS b

On Wed, 11 Oct 2000 05:44:44 -0500, "KEITH T HAYS"

Quote:

>I am attempting to two tables within VB 6.0, adodb code :

>sql = "Select a.one_field, b.two_field" & _
>"FROM a_table" & _
>"JOIN b_table" & _
>"ON a.client_id = b.client_id and" & _
>"a.card_type = b.card_type" & _

>I get an any number of errors one of which says something to the effect that
>my table name is not distinct enough.  This is a part of a much larger SQL
>statement that works fine until I put this in.

>Any suggestions,
>Thanks ahead of time,
>Keith



Sun, 30 Mar 2003 03:00:00 GMT  
 Help with SQL Server 7, VB, and Inner Join
You did not give much to go on.  At least posting the error text would go a
long way.

The SQL is not correct in the example because the tables are not aliased in
the From clause, but (presumably) you are referencing them as "a" and "b" in
the Select and Where clauses.  There are also no spaces between the end of
one line and the beginning of the next line within your double quotes.

Jeff
G. A. Sullivan



Quote:
> I am attempting to two tables within VB 6.0, adodb code :

> sql = "Select a.one_field, b.two_field" & _
> "FROM a_table" & _
> "JOIN b_table" & _
> "ON a.client_id = b.client_id and" & _
> "a.card_type = b.card_type" & _

> I get an any number of errors one of which says something to the effect
that
> my table name is not distinct enough.  This is a part of a much larger SQL
> statement that works fine until I put this in.

> Any suggestions,
> Thanks ahead of time,
> Keith



Mon, 31 Mar 2003 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. SELECT . INNER JOIN--INNER JOIN

2. Using ado recordset in an SQL Server inner join

3. Help: INNER JOIN problem, any SQL-Gurus ?

4. INNER JOINS SQL from VB

5. sql guru's - need help with an inner join

6. Automatic SQL Generation for INNER JOINs

7. SQL INNER JOIN

8. SQL - INNER JOIN syntax

9. VB5: SQL statement with INNER JOIN

10. SQL Inner Join Query

11. Using INNER JOIN with SQL

12. Inner join with case insensitive match in SQL

 

 
Powered by phpBB® Forum Software