[thelist] MySQL SELECT statement and functions

Joshua Olson joshua at alphashop.net
Wed Jun 27 22:17:56 CDT 2001


Not ever really used MySQL, but what about:

SELECT
  $table_name.*,
  Floor(orderid) AS floor_id
FROM $table_name
WHERE orderid NOT LIKE '%x%'
ORDER BY Floor(floor_id) ASC

But, even that aside, I am seeing something very disturbing with the query:

Is Floor a rounding function?

Also, it looks like orderid is a string (orderid NOT LIKE '%x%') in the
WHERE clause and a numeric of some sort in the ORDER BY clause.  Which is
it?

-joshua

----- Original Message -----
From: "jon steele" <jjsteele22 at yahoo.com>
Subject: [thelist] MySQL SELECT statement and functions


: Hi all,
:
: I'm trying to execute an sql select statement in MySQL, but wish to use
: a function in the ORDER BY clause. This gives an error. When I remove
: the Floor() function, it works. Does anyone know why this is and what I
: can do to work around it? This is only with MySQL (a similar query in
: MSAccess worked):
:
: SELECT * FROM $table_name WHERE orderid NOT LIKE '%x%' ORDER BY
: Floor(orderid) ASC;
:
: Any insight's appreciated.
:
: Thanks,
: Jon.





More information about the thelist mailing list