ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Query Error? (Works in mySQL) (https://www.excelbanter.com/excel-programming/391616-query-error-works-mysql.html)

CP Developer

Query Error? (Works in mySQL)
 
I have the following query. The point of the query is to select data from a
table where the date is the most recent date.

select * from pax.poa_132 P1 inner join (Select Max(ArchiveDate) as MaxDate
from pax.poa_132)P2 on P1.ArchiveDate = P2.MaxDate and ACCOUNT_ALIAS = '1XA';

This query works in MySql Query broswer.

I am trying to use this query to import data into Excel 2007. I have set up
my odbc connection using MySql ODBC 3.51. When I get to the last step, to
place the data into excel, I have the ability to edit the query. This
pulls up Microsoft Query (which I have never used before).

I click on the SQL button and add in the query above. I get this message:

SQL Query can't be represented graphically. Continue Anyway?

And then this error:

Unknown column 'P2.MaxDate' in 'on clause'

Thanks in advance for any help.

Steve


CP Developer

Query Error? (Works in mySQL)
 
I'm still stuck on this... any ideas? Thank you

"CP Developer" wrote:

I have the following query. The point of the query is to select data from a
table where the date is the most recent date.

select * from pax.poa_132 P1 inner join (Select Max(ArchiveDate) as MaxDate
from pax.poa_132)P2 on P1.ArchiveDate = P2.MaxDate and ACCOUNT_ALIAS = '1XA';

This query works in MySql Query broswer.

I am trying to use this query to import data into Excel 2007. I have set up
my odbc connection using MySql ODBC 3.51. When I get to the last step, to
place the data into excel, I have the ability to edit the query. This
pulls up Microsoft Query (which I have never used before).

I click on the SQL button and add in the query above. I get this message:

SQL Query can't be represented graphically. Continue Anyway?

And then this error:

Unknown column 'P2.MaxDate' in 'on clause'

Thanks in advance for any help.

Steve


NickHK[_3_]

Query Error? (Works in mySQL)
 
Have you omit the "AS" keywords from the SQL ?
What do do these mean ?
pax.poa_132 P1
pax.poa_132)P2

NickHK

"CP Developer" ...
I have the following query. The point of the query is to select data from
a
table where the date is the most recent date.

select * from pax.poa_132 P1 inner join (Select Max(ArchiveDate) as
MaxDate
from pax.poa_132)P2 on P1.ArchiveDate = P2.MaxDate and ACCOUNT_ALIAS =
'1XA';

This query works in MySql Query broswer.

I am trying to use this query to import data into Excel 2007. I have set
up
my odbc connection using MySql ODBC 3.51. When I get to the last step, to
place the data into excel, I have the ability to edit the query. This
pulls up Microsoft Query (which I have never used before).

I click on the SQL button and add in the query above. I get this message:

SQL Query can't be represented graphically. Continue Anyway?

And then this error:

Unknown column 'P2.MaxDate' in 'on clause'

Thanks in advance for any help.

Steve





All times are GMT +1. The time now is 05:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com