Subquerys don't become available until 4.1 Version 3.X does not support
them
>From Mysql.com
For MySQL versions prior to 4.1, most subqueries can be successfully
rewritten using joins and and other methods. See section 6.4.2.11 Rewriting
Subqueries for Earlier MySQL Versions.
Also, if they worked, the second select would return 5 rows of data, and
with an IN you would want a comma seperated list. but then again, htis
method could work and i just may not be familiar with it.
hth
Jeff
"Jeff Sawatzky"
<[EMAIL PROTECTED] To: <[EMAIL PROTECTED]>
om> cc:
Subject: subquery issue
11/14/2003 10:41
AM
I have a table called journal with the following fields
ID = auto INT
Date = DATE
Order = INT
Entry = TEXT
The table stores journal entries and saves the date that the entry was
entered on. The Order just ells me what order the entries were entered
if there is more than one entry per date. I want to retrieve all the
entries for that last five days with entries. Below is my query, but it
doesn't work.
SELECT *, DATE_FORMAT(journal.Date, '%W, %M %D, %Y') AS newDate FROM
journal WHERE journal.Date IN (SELECT DISTINCT journal.Date FROM journal
ORDER BY journal.Date DESC LIMIT 5) ORDER BY journal.Date DESC,
journal.Order DESC
I get the following error:
Query failed : You have an error in your SQL syntax near 'SELECT
DISTINCT journal.Date FROM journal ORDER BY journal.Date DESC LIMIT 5)
O' at line 1
Does anyone know why this is happening? The version of mySQL I am using
is 3.23.
Jeff Sawatzky
[EMAIL PROTECTED]
416-250-9111 x253
1-800-525-2568
Ontario Service Safety Alliance
4950 Yonge Street Suite 1500
Toronto, Ontario, Canada
M2N 6K1
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]