• i would think youll start with a case expression, and then order by the tagname anyway as the second condition;

    how do you get the value "tagor1", for example? uis that the full tagname, or a substring?

    ORDER BY

    CASE

    WHEN TagName LIKE ' %DataDownloadBit%' THEN 1

    WHEN TagName LIKE '%NextAddDeletePO%' THEN 2

    WHEN TagName LIKE '%NextPONonConfFlg%' THEN 3

    WHEN TagName LIKE '%NextPOTargtQuant%' THEN 4

    WHEN TagName LIKE '%NextPOSapCode%' THEN 5

    WHEN TagName LIKE '%NextPOSeq%' THEN 6

    WHEN TagName LIKE '%NextCasingCode%' THEN 7

    WHEN TagName LIKE '%NextPOTank%' THEN 8

    WHEN TagName LIKE '%NextNumPart1%' THEN 9

    WHEN TagName LIKE '%NextNumPart2%' THEN 10

    WHEN TagName LIKE '%NextNumPart3%' THEN 1`

    WHEN TagName LIKE '%NextWHENgNumPart1%' THEN 12

    WHEN TagName LIKE '%NextWHENgmPart2%' THEN 13

    WHEN TagName LIKE '%NextWHENgNumPart3%'THEN 14

    ELSE 99 END,TagName --tagor1 substring isntead?

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!