mysql order by date



  • 1. Ordering models in a list then saving to db
    Hi guys, I am trying to allow the models in a mysql database to be ordered by the site owner. I was thinking along the lines of a <SELECT> list containing the model names and Up and Down buttons to move the models up and down the list. I am unable to come up with a solution for getting the order from the list however. Any suggestions? Thanks for your time, Matt
  • 2. Palm documentation
    Does anybody know where the Palm Pilot PHP documentation got to? I can't find it anywhere on the net. Could someone post it if not? Muchas Gracias, Eric --- Jesus saves, but Buddha makes incremental backups. ---
  • 3. php site deployment
    I need some advise for how to make a installer to set up a php site. I want it to be able ask user to enter the root directory, mysql server information and copy files into the relevant location. Any help will be appreciated. Jorn

mysql order by date

Postby Spam sucks » Wed, 08 Oct 2003 18:34:24 GMT


Is it possible to order a mysql query by the following date notation

06-10-2003 14:40:55

Thanks in advance.


Re: mysql order by date

Postby Spam sucks » Wed, 08 Oct 2003 18:44:47 GMT


 Is it possible to order a mysql query by the following date notation

forgot to tell it is like day - month - year

25-12-2003 14:40:55



Re: mysql order by date

Postby Markus Ernst » Wed, 08 Oct 2003 23:34:09 GMT

"Spam sucks" <nomail> schrieb im Newsbeitrag

Why not make a normal datetime field (format 0000-00-00 00:00:00,
year-month-day) which is easy to be sorted (ORDER BY date)? You can change
the output to your preferred format easily with PHP, either with the date()
function or by exploding and rearranging it.


Re: mysql order by date

Postby Tom Thackrey » Thu, 09 Oct 2003 01:13:36 GMT

assuming the above formatted string is in a field called fred, you could add
this to the end of your select:

order by

Tom Thackrey
tom (at) creative (dash) light (dot) com
do NOT send email to  XXXX@XXXXX.COM  (it's reserved for spammers)

Similar Threads:

1.Distinct Name with date Order by date

On Wed, 28 Nov 2007 20:40:01 +0100, < XXXX@XXXXX.COM > wrote:

> Here's my issue.  I'm tracking product interest so to speak.  Each
> time a user clicks on a product the userid, product id, and date is
> tracked.  Now users usually look at their products of interest several
> times.  So everytime they click the same product it is tracked as
> well.
> So as an administrator I want to look at the product to see who's
> checked it out and how many times (ie interest level).
> Here's what I have now
> A.A.  -  Last Access: 11-12-2007 Total: 2
> B.B.  -  Last Access: 11-26-2007 Total: 2
> I can onlly get distinct user and order by name. Then while looping
> get the last access date.
> But I want the most recent person whos looked at the product to be on
> top and  don't want see A.A... multiple times.

Sure, prefectly possible in just one query.

comp.databases.<flavour of your database>
or possibly:
(allthough the latter is not in my list, so I won't see it)
Rik Wasmus

2.SELECT date ORDER BY question

Hi there,

I would like to sort a query by date in ascending order, however I do
not want 'empty' dates to appear at the top, I want them to appear at
the bottom instead.

Is there any way I can do this with one SQL query?

desired result:

2007-07-11 09:00:00
2007-07-12 10:00:00
2007-07-13 11:00:00
0000-00-00 00:00:00
0000-00-00 00:00:00


Many thanks,
Steve to order, then limit, then order?

Hello.  I hope this question isn't too silly.  I am working on a PHP/
mysql application that has a list of (scientific research) papers, a
list of keywords, and a list that makes links between the two.

What I'm trying to do is to show just the most popular keywords, and
to show them in alphabetical order.

My approach (illustrated at the end, with a query that workd) is to
order by a count of use, and then to limit the results.  But, as I
imagine the clever folks who read this group will see quickly, the
query leaves the keywords ordered by popularity.

Q: is there a way that I can get Mysql to take the results of this
query and then order them alphabetically, or should I be doing that in
PHP?  (I assume it would be faster to do it in mysql.  And, I may as
well admit it, I am enjoying learning mysql, so I'd like to get this
task done in that domain instead of in PHP.)

Many thanks, to anyone who is kind enough to offer some advice.



SELECT Keyword, KeywordID, count( PaperID )
FROM Papers_Keywords
LEFT JOIN Keywords ON ( = Papers_Keywords.KeywordID )
ORDER BY count( Keyword ) DESC
LIMIT 0 , 5;

4.ORDER BY with special order scheme?

5.Select Records In Order Based on an Ordered ID List


Let's say I have an ordered list of ids that correspond to an ordered
list of records I want to retrieve,  ie. 32,80,10,90,28,5

What's the most efficient way to retrieve the records corresponding to
the ids in the same order as the ids?  It seems the IN clause doesn't
preserve ordering, and using UNION to submit the same query with
different id WHERE clauses seems messy/inefficient.


6. cyrillic in utf8 collation but ORDER BY returns random order

7. Order By - Fair ordering on eccomerce site

8. date order by

Return to php


Who is online

Users browsing this forum: No registered users and 47 guest