Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2005
    Location
    New England
    Posts
    35

    Unanswered: Ordering Queries

    I have a query which I would like to order in a specific way, but am at a loss on how to do it. It has four fields (all yes/no), and I need it to return the records in the following way:

    Field1 is 8AM (Yes/No)
    Field2 is 12PM (Yes/No)
    Field3 is 3PM (Yes/No)
    Field4 is 8PM (Yes/No)

    I need to have the records ordered so that all the 8AMs are first, and then 8AMs AND 12PMs, then 8AMs AND 12pms AND 3PMs, then all four are yes's
    then 12PMs alone, then 12PMs AND 3PMs, etc etc.

    Is there a way to do this, and if so how?

    Thanks so much for any help.

    P.S. I'm fairly new so need specifics on how and where to put things. Thanks

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Hi

    Can't quite think it through but I think you are asking for something dead simple. Wouldn't:
    Code:
    Order By Field1, Field2, Field3, Field4
    order them exactly as you are after?
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Aug 2005
    Location
    New England
    Posts
    35

    It works well enough

    but the 8AMs only are getting pushed back a bit. I'm looking for a way to get them to the top.

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Rapuint

    On the face of it there is no easy way to do what you want. The main problem is that it looks as if your data storage (physical design) is not optimized / stored optimally.

    First off it possible that the time maybe being stored as text rather that as time.

    However the main problem that I see is that the 4 coloumns containing the time values should be in a sub table. That way rtound what you want to achieve is failry straightforward.

    HTH

  5. #5
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Quote Originally Posted by RAPUNIT
    but the 8AMs only are getting pushed back a bit. I'm looking for a way to get them to the top.
    Ah - well in that case you are looking at ordering with a hefty Iif statement. Or go with Healdem.
    Testimonial:
    pootle flump
    ur codings are working excelent.

Posting Permissions

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