Order by Date then ID

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default Order by Date then ID

    I have a query that orders things by date. The database itself only has
    dates in it, not times, so what I want to do is find items in the
    database by date, then by ID - so that the latest item always comes out
    first (hope that makes sense!).

    Can you set the order twice within the same query?

    LB
    LB Guest

  2. Similar Questions and Discussions

    1. Order By Date/Time Issue
      While this is more an annoyance than a problem, I'm wondering if it's something I'm doing or systematic. I'm running the query below to pull...
    2. JSObject returns wrong date. How can Iextract correct date from digital signature?
      I'm trying to extract name and date from digital signatures by using JSObject in Excel VBA, but JSObject returns wrong date. Year, month, hour and...
    3. Tab Order always greyed out, need to redefine order but can't
      I had a check box but then i had to delete it and change it to a text field. now my tab order is all out of whack and I can't seem to set the tab...
    4. Order Query Results by date
      I am pulling records from an Access database and trying to order by the date. However, CF seems to be ordering the dates by the math value (i.e....
    5. Updating records in order (into an order)
      I'm storing questions for a user-defined quiz. I can store them in the order they are entered without any problem. But... The user needs to have...
  3. #2

    Default Re: Order by Date then ID

    > Can you set the order twice within the same query?
    >
    I think you can.

    ORDER BY date AND id

    Give it a try and you will find out.

    Good luck!


    --
    Posted by [url]news://news.nb.nu[/url]
    Steven Guest

  4. #3

    Default Re: Order by Date then ID

    Steven wrote:
    >>Can you set the order twice within the same query?
    >>
    >
    > I think you can.
    >
    > ORDER BY date AND id
    >
    > Give it a try and you will find out.
    >
    > Good luck!
    Thanks Steven,

    Tried that, but doing it that way for some reason took out the date
    sorting altogether (or at least seemed to). So I tried;

    ORDER BY DATE ASC AND ID ASC

    But that threw an error :-(


    LB Guest

  5. #4

    Default Re: Order by Date then ID

    > Tried that, but doing it that way for some reason took out the date
    > sorting altogether (or at least seemed to). So I tried;
    >
    > ORDER BY DATE ASC AND ID ASC
    >
    > But that threw an error :-(
    Hmmm try this :

    ORDER BY date DESC, id DESC
    This should work.


    --
    Posted by [url]news://news.nb.nu[/url]
    Steven Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139