Results 1 to 5 of 5
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts
    SSQL = "Select TIPO_MERCATO, TIPO_DISTRETTO,DATA_RIEPILOGO,SITUAZ_AL,TOP_RAPP,T OP_UTILIZZ FROM RIEPILOGO WHERE LEFT(TIPO_MERCATO,4)= '" & TEST_AREA & "' ORDER BY VAL(MID(TIPO_MERCATO,5,8))"

    I want to oreder the rset by TIPO_MERCATO.

    The records in TIPO_MERCATO are similar:

    8505-50163746-XXXXXXXXXXXX
    8505-50163743-YYYYYYYYYYYYYY
    8505-50163744-ZZZZZZZZZZZZ
    8505-50163745-KKKKKKKKKKKK

    But the sql not set the correct order...?????

    Note:
    the field TIPO_MERCATO in table is setting TEXT

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='sal21' post='770764' date='16-Apr-2009 11:18']But the sql not set the correct order...?????[/quote]
    If I understand correctly, you want to sort on the 50163....
    The 5 is the sixth character.
    The order clause should be :
    ORDER BY VAL(MID(TIPO_MERCATO,6,8))
    Francois

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts
    RESOLVED! TKS

    yes! correct
    but the index is 13 character 85xx-yyyyxxxz....

    similar:
    8505-50163746-xxxx...
    8501-50173746-yyyyy....
    8504-50269746-zzzzzz....

  4. #4
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='sal21' post='770769' date='16-Apr-2009 12:39']but the index is 13 character 85xx-yyyyxxxz....[/quote]
    If they have all the same structure, why converting to a number ?
    ORDER BY MID(TIPO_MERCATO,6)

    If you want to convert it to a number then use :
    ORDER BY VAL(MID(TIPO_MERCATO,6,8) & Mid(TIPO_MERCATO,15))

    Or did I understand it wrong again ?
    Francois

  5. #5
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='Francois' post='770772' date='16-Apr-2009 12:52']If they have all the same structure, why converting to a number ?
    ORDER BY MID(TIPO_MERCATO,6)

    If you want to convert it to a number then use :
    ORDER BY VAL(MID(TIPO_MERCATO,6,8) & Mid(TIPO_MERCATO,15))

    Or did I understand it wrong again ?[/quote]

    Resolved tks!

Posting Permissions

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