Hi,

You will get a MySQL query syntax error number 1064 when you incorrectly use a reserved words in your query . * and DISTINCT cannot appear together. Check with the SELECT clause column list.

Thanks
ViSolve DB Team.
----- Original Message ----- From: "Alan Milnes" <[EMAIL PROTECTED]>
To: <mysql@lists.mysql.com>
Sent: Tuesday, October 24, 2006 12:47 AM
Subject: Creating new table from distinct entries


MySQL 4.1.21-community-nt

I have a table in my database that has a Primary key on 2 fields (MyID and MyChange) and a field that indicates if there is a problem with the record (MyError)- I want to create a new table that only has unique MyIDs and where there is more than 1 I only want the record with the highest MyChange number. The table has about 50 fields so I have the following code:-

CREATE TABLE mystats SELECT *, DISTINCT MyID FROM oldstats WHERE MyError IS NULL ORDER BY MyChange DESC ;

but I am getting an MySQL error #1064.

Any ideas or suggestions as to where I am going wrong?

Alan

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to