Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2011
    Posts
    4

    Unanswered: New at the right forum

    Hello everybody,

    I am new and without experience doing queries in Access. A friend advise me to join the wrong forum -Microsoft SQL, but I got fast help from a nice person. The problem is that now I have to convert this information into an IIF statement or maybe if someone has another idea...I will be very thankful.

    My problem is that I need to do a query to show only the error in a sequence of numbers in two columns. The number from "RangeTo" has to be in the next row of the column to the left. If there is another number it is consider a "0".
    Can someone be so kind and help me please.

    |ID | |RangeFrom ||RangeTo|
    |001| | 0 | |4.5 |
    |002| | 4.5 | |6.8 |
    |003| | 6.8 | |8.5 |
    |004| | 8.5 | |10.2 |
    |005| |11.2 | |12.6 |
    |006| |12.6 | |4.5 |

    This is the answer I got at the Microsoft SQL forum:

    SELECT T.Id,
    CASE WHEN F.RangeTo = T.RangeFrom THEN T.RangeFrom ELSE 0 END as T.RangeFrom,
    T.RangeTo
    FROM DaTable as T --To table
    INNER JOIN DaTable as F ON -- From table
    T.Id = F.Id + 1
    ORDER BY T.Id

  2. #2
    Join Date
    Nov 2010
    Posts
    84
    The solution to your problem is attached.
    Attached Files Attached Files

  3. #3
    Join Date
    Jun 2011
    Posts
    4
    I really appreciate your help!
    Thanks so much

Posting Permissions

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