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

 

Reply via email to