Consulting

Results 1 to 2 of 2

Thread: How to order intercalary rows

  1. #1
    VBAX Newbie
    Joined
    Oct 2015
    Posts
    4
    Location

    How to order intercalary rows

    Hi!
    I have 1 table with State "On" and "Off" that belong to a certain machine, I want to order Off On Off On Off On considering that the "Off" following by the "One" are in the same machine.


    Input:
    State Machine
    On A
    On F
    Off H
    On D
    On H
    On A
    Off B
    Off B
    Off F
    Off K
    On F
    Off D
    On B
    Off A
    ....


    Output:
    State Machine
    Off A
    On A
    Off B
    On B
    ....




    I really appreciate your help,

  2. #2
    VBAX Expert
    Joined
    Oct 2012
    Posts
    726
    Location
    SELECT distinct state, machine
    FROM states
    order by machine, state
    assuming your table is called 'states'

Posting Permissions

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