mike wOZniewski wrote:

Hi... silly question maybe.

I want to execute the following query:

mysql_query("SELECT MIN(order), MAX(order) FROM downloads WHERE class='1'");

order is a reserved word.
try:
MIN(`order`), MAX(`order`)

Note use back ticks ` NOT '


...but it doesn't work and gives me a SYNTAX ERROR. If I use my 'id' column (the primary key) instead of the 'order' column, it works fine:

mysql_query("SELECT MIN(id), MAX(id) FROM downloads WHERE class='1'");

My columns are defined as follows:

CREATE TABLE downloads (
 id int(11) NOT NULL auto_increment,
 class tinyint(1) NOT NULL default '0',
 order int(11) NOT NULL default '1',
 PRIMARY KEY  (id)
) TYPE=MyISAM;

Does anyone know why I'm getting a syntax error? Does MIN() and MAX() only
work for primary keys, or auto columns?

Thanks.







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



Reply via email to