Order By Command Not Working

Hi,

I have a report where I'm trying to sort by last name then first name.  I cannot get the Order By command to work.  Can someone share with me what I might be doing wrong?  Syntax Below:

ORDER BY d.lname, d.fname DESC

Parents
  • Hi Triland,

     

    You don’t say which report environment you are using, Infomaker or SSRS?  No matter what your sql code or stored procedure is sorting by will be overridden by the report tool’s sorting method.

     

    This example shows where the Sorting is determined in an Infomaker Report.  In SSRS there are similar options.

     

     

    From: Triland McConico [mailto:bounce-trilandmcconico7946@tessituranetwork.com]
    Sent: Friday, October 26, 2012 2:32 PM
    To: Doug Jones
    Subject: RE: [Tessitura Technical Forum] Order By Command Not Working

     

    Still would not go.  I did it just as shown.

     

    Triland L. McConico

     

    From: Tessitura Technical Forum [mailto:forums-technical@tessituranetwork.com] On Behalf Of Lucie Spieler
    Sent: Friday, October 26, 2012 3:05 PM
    To: Triland McConico
    Subject: RE: [Tessitura Technical Forum] Order By Command Not Working

     

    What if you do this?

     

    SELECT DISTINCT

                      b.customer_no,

                      e.perf_code,

                      e.perf_dt,

                      f.description AS perf_name,

                      i.description AS prod_season_name,

                      f.text3 AS studio_teacher,

                      d.fname,

                      d.lname,

                      DATEDIFF(year, CONVERT(nvarchar(30),

                      z.key_value, 126),

                      CONVERT(nvarchar(30),

                      GETDATE(), 126)) AS age_in_years,

                      ISNULL(dbo.AF_FORMAT_STRING(t.phone, '(@@@) @@@-@@@@'), '') AS phone_1,

                      x.description AS PriceType,

                      assoc.fname AS associated_fname,

                      assoc.lname AS associated_lname,

                      assoc.sort_name AS associated_sort_name, --ADDITION HERE

                      T_SPECIAL_REQ.notes

                      FROM         T_SUB_LINEITEM AS a INNER JOIN

                      T_ORDER AS b ON a.order_no = b.order_no INNER JOIN

                      T_LINEITEM AS c ON a.li_seq_no = c.li_seq_no INNER JOIN

                      T_CUSTOMER AS d ON b.customer_no = d.customer_no INNER JOIN

                      VS_PERF AS e ON a.perf_no = e.perf_no INNER JOIN

                      T_PROD_SEASON AS h ON e.prod_season_no = h.prod_season_no INNER JOIN

                      T_INVENTORY AS f ON e.perf_no = f.inv_no INNER JOIN

                      T_INVENTORY AS i ON h.prod_season_no = i.inv_no INNER JOIN

                      T_ADDRESS AS g ON d.customer_no = g.customer_no AND g.primary_ind = 'Y' INNER JOIN

                      TR_PRICE_TYPE AS x ON a.price_type = x.id INNER JOIN

                      T_SPECIAL_REQ ON a.li_seq_no = T_SPECIAL_REQ.li_seq_no LEFT OUTER JOIN

                      TX_CUST_KEYWORD AS z ON b.customer_no = z.customer_no AND z.keyword_no = 1 LEFT OUTER JOIN

                      T_PHONE AS t ON b.customer_no = t.customer_no AND t.type = 1 LEFT OUTER JOIN

                      T_CUSTOMER AS assoc ON assoc.customer_no = T_SPECIAL_REQ.assoc_customer_no

                      WHERE     (e.season = @season_no) AND

                      (@prod_season_no = h.prod_season_no) AND

                      (@perf_no = e.perf_no) AND

                      (a.comp_code <> 32 OR

                      a.comp_code IS NULL)

     

                      ORDER BY assoc.sort_name

                      --associated_lname DESC, associated_fname DESC

     

     

    _____________________________
    Lucie Spieler
    IT Development and Training Manager

    Editor, Season Program Book

    FLORIDA GRAND opera
    8390 NW 25th Street
    Miami, FL 33122
    305.854.1643 x. 1521
    Box Office: 800.741.1010
    To Give a Gift: 305.403.3315
    www.FGO.org

    2012-2013 | 72ND SEASON

    La bohème | The Magic Flute | La sonnambula | La traviata

     

    From: Tessitura Technical Forum [mailto:forums-technical@tessituranetwork.com] On Behalf Of Triland McConico
    Sent: Friday, October 26, 2012 4:30 PM
    To: Lucie Spieler
    Subject: RE: [Tessitura Technical Forum] Order By Command Not Working

     

    Can you share with me exactly how your using that code in your report.  I do see it in the table however, it is like my report simply will not render that way. 

     

    SELECT DISTINCT

                      b.customer_no, e.perf_code, e.perf_dt, f.description AS perf_name, i.description AS prod_season_name, f.text3 AS studio_teacher, d.fname, d.lname,

                      DATEDIFF(year, CONVERT(nvarchar(30), z.key_value, 126), CONVERT(nvarchar(30), GETDATE(), 126)) AS age_in_years,

                      ISNULL(dbo.AF_FORMAT_STRING(t.phone, '(@@@) @@@-@@@@'), '') AS phone_1, x.description AS PriceType, assoc.fname AS associated_fname,

                      assoc.lname AS associated_lname, T_SPECIAL_REQ.notes

                      FROM         T_SUB_LINEITEM AS a INNER JOIN

                      T_ORDER AS b ON a.order_no = b.order_no INNER JOIN

                      T_LINEITEM AS c ON a.li_seq_no = c.li_seq_no INNER JOIN

                      T_CUSTOMER AS d ON b.customer_no = d.customer_no INNER JOIN

                      VS_PERF AS e ON a.perf_no = e.perf_no INNER JOIN

                      T_PROD_SEASON AS h ON e.prod_season_no = h.prod_season_no INNER JOIN

                      T_INVENTORY AS f ON e.perf_no = f.inv_no INNER JOIN

                      T_INVENTORY AS i ON h.prod_season_no = i.inv_no INNER JOIN

                      T_ADDRESS AS g ON d.customer_no = g.customer_no AND g.primary_ind = 'Y' INNER JOIN

                      TR_PRICE_TYPE AS x ON a.price_type = x.id INNER JOIN

                      T_SPECIAL_REQ ON a.li_seq_no = T_SPECIAL_REQ.li_seq_no LEFT OUTER JOIN

                      TX_CUST_KEYWORD AS z ON b.customer_no = z.customer_no AND z.keyword_no = 1 LEFT OUTER JOIN

                      T_PHONE AS t ON b.customer_no = t.customer_no AND t.type = 1 LEFT OUTER JOIN

                      T_CUSTOMER AS assoc ON assoc.customer_no = T_SPECIAL_REQ.assoc_customer_no

                      WHERE     (e.season = @season_no) AND (@prod_season_no = h.prod_season_no) AND (@perf_no = e.perf_no) AND (a.comp_code <> 32 OR

                      a.comp_code IS NULL)

     

                      ORDER BY associated_lname DESC, associated_fname DESC

                </CommandText>

     

    Triland L. McConico

     

    From: Tessitura Technical Forum [mailto:forums-technical@tessituranetwork.com] On Behalf Of Lucie Spieler
    Sent: Friday, October 26, 2012 1:42 PM
    To: Triland McConico
    Subject: RE: [Tessitura Technical Forum] Order By Command Not Working

     

    There is a new column in t_customer called sort_name, which is what I am using.

     

    _____________________________
    Lucie Spieler
    IT Development and Training Manager

    Editor, Season Program Book

    FLORIDA GRAND opera
    8390 NW 25th Street
    Miami, FL 33122
    305.854.1643 x. 1521
    Box Office: 800.741.1010
    To Give a Gift: 305.403.3315
    www.FGO.org

    2012-2013 | 72ND SEASON

    La bohème | The Magic Flute | La sonnambula | La traviata

     

    From: Tessitura Technical Forum [mailto:forums-technical@tessituranetwork.com] On Behalf Of Triland McConico
    Sent: Friday, October 26, 2012 3:13 PM
    To: Lucie Spieler
    Subject: RE: [Tessitura Technical Forum] Order By Command Not Working

     

     

    I tried and it still does not work.  Anything else I might try.  Where you able to get it to work on your side.

     

    Triland L. McConico

     

    From: Tessitura Technical Forum [mailto:forums-technical@tessituranetwork.com] On Behalf Of Jason Kaiser
    Sent: Friday, October 26, 2012 12:52 PM
    To: Triland McConico
    Subject: Re: [Tessitura Technical Forum] Order By Command Not Working

     

    Try:   ORDER BY d.lname, d.fname

    From: Triland McConico <bounce-trilandmcconico7946@tessituranetwork.com>
    Sent: 10/25/2012 6:54:00 PM

    Hi,

    I have a report where I'm trying to sort by last name then first name.  I cannot get the Order By command to work.  Can someone share with me what I might be doing wrong?  Syntax Below:

    ORDER BY d.lname, d.fname DESC




    This message was sent automatically to you by www.tessituranetwork.com because you subscribed to the Tessitura Technical Forum. You may reply to this message to post to the Technical forum or visit the site to search, read and post to the forums. In the interest of keeping the forum posts from becoming cluttered, we encourage you to delete previous message text from your reply before sending. Thank you!




    This message was sent automatically to you by www.tessituranetwork.com because you subscribed to the Tessitura Technical Forum. You may reply to this message to post to the Technical forum or visit the site to search, read and post to the forums. In the interest of keeping the forum posts from becoming cluttered, we encourage you to delete previous message text from your reply before sending. Thank you!




    This message was sent automatically to you by www.tessituranetwork.com because you subscribed to the Tessitura Technical Forum. You may reply to this message to post to the Technical forum or visit the site to search, read and post to the forums. In the interest of keeping the forum posts from becoming cluttered, we encourage you to delete previous message text from your reply before sending. Thank you!




    This message was sent automatically to you by www.tessituranetwork.com because you subscribed to the Tessitura Technical Forum. You may reply to this message to post to the Technical forum or visit the site to search, read and post to the forums. In the interest of keeping the forum posts from becoming cluttered, we encourage you to delete previous message text from your reply before sending. Thank you!




    This message was sent automatically to you by www.tessituranetwork.com because you subscribed to the Tessitura Technical Forum. You may reply to this message to post to the Technical forum or visit the site to search, read and post to the forums. In the interest of keeping the forum posts from becoming cluttered, we encourage you to delete previous message text from your reply before sending. Thank you!




    This message was sent automatically to you by www.tessituranetwork.com because you subscribed to the Tessitura Technical Forum. You may reply to this message to post to the Technical forum or visit the site to search, read and post to the forums. In the interest of keeping the forum posts from becoming cluttered, we encourage you to delete previous message text from your reply before sending. Thank you!




    This message was sent automatically to you by www.tessituranetwork.com because you subscribed to the Tessitura Technical Forum. You may reply to this message to post to the Technical forum or visit the site to search, read and post to the forums. In the interest of keeping the forum posts from becoming cluttered, we encourage you to delete previous message text from your reply before sending. Thank you!

Reply
  • Hi Triland,

     

    You don’t say which report environment you are using, Infomaker or SSRS?  No matter what your sql code or stored procedure is sorting by will be overridden by the report tool’s sorting method.

     

    This example shows where the Sorting is determined in an Infomaker Report.  In SSRS there are similar options.

     

     

    From: Triland McConico [mailto:bounce-trilandmcconico7946@tessituranetwork.com]
    Sent: Friday, October 26, 2012 2:32 PM
    To: Doug Jones
    Subject: RE: [Tessitura Technical Forum] Order By Command Not Working

     

    Still would not go.  I did it just as shown.

     

    Triland L. McConico

     

    From: Tessitura Technical Forum [mailto:forums-technical@tessituranetwork.com] On Behalf Of Lucie Spieler
    Sent: Friday, October 26, 2012 3:05 PM
    To: Triland McConico
    Subject: RE: [Tessitura Technical Forum] Order By Command Not Working

     

    What if you do this?

     

    SELECT DISTINCT

                      b.customer_no,

                      e.perf_code,

                      e.perf_dt,

                      f.description AS perf_name,

                      i.description AS prod_season_name,

                      f.text3 AS studio_teacher,

                      d.fname,

                      d.lname,

                      DATEDIFF(year, CONVERT(nvarchar(30),

                      z.key_value, 126),

                      CONVERT(nvarchar(30),

                      GETDATE(), 126)) AS age_in_years,

                      ISNULL(dbo.AF_FORMAT_STRING(t.phone, '(@@@) @@@-@@@@'), '') AS phone_1,

                      x.description AS PriceType,

                      assoc.fname AS associated_fname,

                      assoc.lname AS associated_lname,

                      assoc.sort_name AS associated_sort_name, --ADDITION HERE

                      T_SPECIAL_REQ.notes

                      FROM         T_SUB_LINEITEM AS a INNER JOIN

                      T_ORDER AS b ON a.order_no = b.order_no INNER JOIN

                      T_LINEITEM AS c ON a.li_seq_no = c.li_seq_no INNER JOIN

                      T_CUSTOMER AS d ON b.customer_no = d.customer_no INNER JOIN

                      VS_PERF AS e ON a.perf_no = e.perf_no INNER JOIN

                      T_PROD_SEASON AS h ON e.prod_season_no = h.prod_season_no INNER JOIN

                      T_INVENTORY AS f ON e.perf_no = f.inv_no INNER JOIN

                      T_INVENTORY AS i ON h.prod_season_no = i.inv_no INNER JOIN

                      T_ADDRESS AS g ON d.customer_no = g.customer_no AND g.primary_ind = 'Y' INNER JOIN

                      TR_PRICE_TYPE AS x ON a.price_type = x.id INNER JOIN

                      T_SPECIAL_REQ ON a.li_seq_no = T_SPECIAL_REQ.li_seq_no LEFT OUTER JOIN

                      TX_CUST_KEYWORD AS z ON b.customer_no = z.customer_no AND z.keyword_no = 1 LEFT OUTER JOIN

                      T_PHONE AS t ON b.customer_no = t.customer_no AND t.type = 1 LEFT OUTER JOIN

                      T_CUSTOMER AS assoc ON assoc.customer_no = T_SPECIAL_REQ.assoc_customer_no

                      WHERE     (e.season = @season_no) AND

                      (@prod_season_no = h.prod_season_no) AND

                      (@perf_no = e.perf_no) AND

                      (a.comp_code &lt;&gt; 32 OR

                      a.comp_code IS NULL)

     

                      ORDER BY assoc.sort_name

                      --associated_lname DESC, associated_fname DESC

     

     

    _____________________________
    Lucie Spieler
    IT Development and Training Manager

    Editor, Season Program Book

    FLORIDA GRAND opera
    8390 NW 25th Street
    Miami, FL 33122
    305.854.1643 x. 1521
    Box Office: 800.741.1010
    To Give a Gift: 305.403.3315
    www.FGO.org

    2012-2013 | 72ND SEASON

    La bohème | The Magic Flute | La sonnambula | La traviata

     

    From: Tessitura Technical Forum [mailto:forums-technical@tessituranetwork.com] On Behalf Of Triland McConico
    Sent: Friday, October 26, 2012 4:30 PM
    To: Lucie Spieler
    Subject: RE: [Tessitura Technical Forum] Order By Command Not Working

     

    Can you share with me exactly how your using that code in your report.  I do see it in the table however, it is like my report simply will not render that way. 

     

    SELECT DISTINCT

                      b.customer_no, e.perf_code, e.perf_dt, f.description AS perf_name, i.description AS prod_season_name, f.text3 AS studio_teacher, d.fname, d.lname,

                      DATEDIFF(year, CONVERT(nvarchar(30), z.key_value, 126), CONVERT(nvarchar(30), GETDATE(), 126)) AS age_in_years,

                      ISNULL(dbo.AF_FORMAT_STRING(t.phone, '(@@@) @@@-@@@@'), '') AS phone_1, x.description AS PriceType, assoc.fname AS associated_fname,

                      assoc.lname AS associated_lname, T_SPECIAL_REQ.notes

                      FROM         T_SUB_LINEITEM AS a INNER JOIN

                      T_ORDER AS b ON a.order_no = b.order_no INNER JOIN

                      T_LINEITEM AS c ON a.li_seq_no = c.li_seq_no INNER JOIN

                      T_CUSTOMER AS d ON b.customer_no = d.customer_no INNER JOIN

                      VS_PERF AS e ON a.perf_no = e.perf_no INNER JOIN

                      T_PROD_SEASON AS h ON e.prod_season_no = h.prod_season_no INNER JOIN

                      T_INVENTORY AS f ON e.perf_no = f.inv_no INNER JOIN

                      T_INVENTORY AS i ON h.prod_season_no = i.inv_no INNER JOIN

                      T_ADDRESS AS g ON d.customer_no = g.customer_no AND g.primary_ind = 'Y' INNER JOIN

                      TR_PRICE_TYPE AS x ON a.price_type = x.id INNER JOIN

                      T_SPECIAL_REQ ON a.li_seq_no = T_SPECIAL_REQ.li_seq_no LEFT OUTER JOIN

                      TX_CUST_KEYWORD AS z ON b.customer_no = z.customer_no AND z.keyword_no = 1 LEFT OUTER JOIN

                      T_PHONE AS t ON b.customer_no = t.customer_no AND t.type = 1 LEFT OUTER JOIN

                      T_CUSTOMER AS assoc ON assoc.customer_no = T_SPECIAL_REQ.assoc_customer_no

                      WHERE     (e.season = @season_no) AND (@prod_season_no = h.prod_season_no) AND (@perf_no = e.perf_no) AND (a.comp_code &lt;&gt; 32 OR

                      a.comp_code IS NULL)

     

                      ORDER BY associated_lname DESC, associated_fname DESC

                </CommandText>

     

    Triland L. McConico

     

    From: Tessitura Technical Forum [mailto:forums-technical@tessituranetwork.com] On Behalf Of Lucie Spieler
    Sent: Friday, October 26, 2012 1:42 PM
    To: Triland McConico
    Subject: RE: [Tessitura Technical Forum] Order By Command Not Working

     

    There is a new column in t_customer called sort_name, which is what I am using.

     

    _____________________________
    Lucie Spieler
    IT Development and Training Manager

    Editor, Season Program Book

    FLORIDA GRAND opera
    8390 NW 25th Street
    Miami, FL 33122
    305.854.1643 x. 1521
    Box Office: 800.741.1010
    To Give a Gift: 305.403.3315
    www.FGO.org

    2012-2013 | 72ND SEASON

    La bohème | The Magic Flute | La sonnambula | La traviata

     

    From: Tessitura Technical Forum [mailto:forums-technical@tessituranetwork.com] On Behalf Of Triland McConico
    Sent: Friday, October 26, 2012 3:13 PM
    To: Lucie Spieler
    Subject: RE: [Tessitura Technical Forum] Order By Command Not Working

     

     

    I tried and it still does not work.  Anything else I might try.  Where you able to get it to work on your side.

     

    Triland L. McConico

     

    From: Tessitura Technical Forum [mailto:forums-technical@tessituranetwork.com] On Behalf Of Jason Kaiser
    Sent: Friday, October 26, 2012 12:52 PM
    To: Triland McConico
    Subject: Re: [Tessitura Technical Forum] Order By Command Not Working

     

    Try:   ORDER BY d.lname, d.fname

    From: Triland McConico <bounce-trilandmcconico7946@tessituranetwork.com>
    Sent: 10/25/2012 6:54:00 PM

    Hi,

    I have a report where I'm trying to sort by last name then first name.  I cannot get the Order By command to work.  Can someone share with me what I might be doing wrong?  Syntax Below:

    ORDER BY d.lname, d.fname DESC




    This message was sent automatically to you by www.tessituranetwork.com because you subscribed to the Tessitura Technical Forum. You may reply to this message to post to the Technical forum or visit the site to search, read and post to the forums. In the interest of keeping the forum posts from becoming cluttered, we encourage you to delete previous message text from your reply before sending. Thank you!




    This message was sent automatically to you by www.tessituranetwork.com because you subscribed to the Tessitura Technical Forum. You may reply to this message to post to the Technical forum or visit the site to search, read and post to the forums. In the interest of keeping the forum posts from becoming cluttered, we encourage you to delete previous message text from your reply before sending. Thank you!




    This message was sent automatically to you by www.tessituranetwork.com because you subscribed to the Tessitura Technical Forum. You may reply to this message to post to the Technical forum or visit the site to search, read and post to the forums. In the interest of keeping the forum posts from becoming cluttered, we encourage you to delete previous message text from your reply before sending. Thank you!




    This message was sent automatically to you by www.tessituranetwork.com because you subscribed to the Tessitura Technical Forum. You may reply to this message to post to the Technical forum or visit the site to search, read and post to the forums. In the interest of keeping the forum posts from becoming cluttered, we encourage you to delete previous message text from your reply before sending. Thank you!




    This message was sent automatically to you by www.tessituranetwork.com because you subscribed to the Tessitura Technical Forum. You may reply to this message to post to the Technical forum or visit the site to search, read and post to the forums. In the interest of keeping the forum posts from becoming cluttered, we encourage you to delete previous message text from your reply before sending. Thank you!




    This message was sent automatically to you by www.tessituranetwork.com because you subscribed to the Tessitura Technical Forum. You may reply to this message to post to the Technical forum or visit the site to search, read and post to the forums. In the interest of keeping the forum posts from becoming cluttered, we encourage you to delete previous message text from your reply before sending. Thank you!




    This message was sent automatically to you by www.tessituranetwork.com because you subscribed to the Tessitura Technical Forum. You may reply to this message to post to the Technical forum or visit the site to search, read and post to the forums. In the interest of keeping the forum posts from becoming cluttered, we encourage you to delete previous message text from your reply before sending. Thank you!

Children
No Data