MS SQL -> Access query

MS SQL -> Access query

am 20.10.2007 20:05:55 von pipe.jack

How to build this sql query in Access:

SELECT A._LETTER + B._LETTER
FROM Letters.dbo._LETTERS A, Letters.dbo._LETTERS B

Access doesn't like my FROM clause.

Thanks,
Jack

Re: MS SQL -> Access query

am 20.10.2007 21:11:54 von ForwardZERO_SPAM.To.69Camaro

Hi, Jack.

> Access doesn't like my FROM clause.

It isn't going to like your names that start with an underscore, either.
Remove the underscores and try ANSI SQL's INNER JOIN syntax:

SELECT A.Col1 + B.Col2 AS MyAlias
FROM Table1 A INNER JOIN Table2 B ON A.ID = B.ID;

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blogs: www.DataDevilDog.BlogSpot.com, www.DatabaseTips.BlogSpot.com
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.

Re: MS SQL -> Access query

am 21.10.2007 00:58:34 von pipe.jack

> SELECT A.Col1 + B.Col2 AS MyAlias
> FROM Table1 A INNER JOIN Table2 B ON A.ID = B.ID;

But my letters are pulled from the same table. There is no table A and
table B.

Re: MS SQL -> Access query

am 21.10.2007 01:15:23 von ForwardZERO_SPAM.To.69Camaro

Hi, Jack.

>> SELECT A.Col1 + B.Col2 AS MyAlias
>> FROM Table1 A INNER JOIN Table2 B ON A.ID = B.ID;
>
> But my letters are pulled from the same table. There is no table A and
> table B.

A and B are aliases for the names of the two tables joined in the query,
regardless that it happens to be the same table on both sides of the join.
If it's easier to visualize the syntax, try:

SELECT A.Column1 + B.Column2 AS MyAlias
FROM MyTable A INNER JOIN MyTable B ON A.Column3 = B.Column4;

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blogs: www.DataDevilDog.BlogSpot.com, www.DatabaseTips.BlogSpot.com
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.