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
Try: ORDER BY d.lname, d.fname
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
From: Triland McConico <bounce-trilandmcconico7946@tessituranetwork.com> Sent: 10/25/2012 6:54:00 PM
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!
ORDER BY d.lname DESC, d.fname DESC
There is a new column in t_customer called sort_name, which is what I am using.
_____________________________Lucie SpielerIT Development and Training Manager
Editor, Season Program BookFLORIDA GRAND opera8390 NW 25th StreetMiami, FL 33122305.854.1643 x. 1521Box Office: 800.741.1010To Give a Gift: 305.403.3315www.FGO.org2012-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 McConicoSent: Friday, October 26, 2012 3:13 PMTo: Lucie SpielerSubject: RE: [Tessitura Technical Forum] Order By Command Not Working
From: Tessitura Technical Forum [mailto:forums-technical@tessituranetwork.com] On Behalf Of Jason KaiserSent: Friday, October 26, 2012 12:52 PMTo: Triland McConicoSubject: Re: [Tessitura Technical Forum] Order By Command Not Working
From: Triland McConico <bounce-trilandmcconico7946@tessituranetwork.com>Sent: 10/25/2012 6:54:00 PM
Triland,
What is your desired result, and what are you getting that isn't working?
The line:
should order the results by lname _ascending_, followed by fname descending:
Adams John
Adams Abigail
Brown Sally
Brown Charlie
For ORDER BY "ascending " (asc) is implied, "descending" is must be specified, and you specify it column by column.
--Gawain
I’ve entered just that and it is as if my report is not recognizing it. The names still appear ordered by account number.
From: Tessitura Technical Forum [mailto:forums-technical@tessituranetwork.com] On Behalf Of Gawain Lavers Sent: Friday, October 26, 2012 1:48 PM To: Triland McConico Subject: RE: [Tessitura Technical Forum] Order By Command Not Working
From: Triland McConico <bounce-trilandmcconico7946@tessituranetwork.com> Sent: 10/26/2012 2:07:54 PM
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>
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
_____________________________ 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
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
What if you do this?
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
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
ORDER BY assoc.sort_name
--associated_lname DESC, associated_fname DESC
From: Tessitura Technical Forum [mailto:forums-technical@tessituranetwork.com] On Behalf Of Triland McConicoSent: Friday, October 26, 2012 4:30 PMTo: Lucie SpielerSubject: RE: [Tessitura Technical Forum] Order By Command Not Working
From: Tessitura Technical Forum [mailto:forums-technical@tessituranetwork.com] On Behalf Of Lucie SpielerSent: Friday, October 26, 2012 1:42 PMTo: Triland McConicoSubject: RE: [Tessitura Technical Forum] Order By Command Not Working
Triland
Check that your reporting application (Infomaker or SSRS) is not doing its own sorting.
Fernando Margueirat Business Analyst The National Ballet of Canada 470 Queens Quay West Toronto, Ontario M5V 3K4 P: 416 345 9686 x453 F: 416 345 8323
From: Tessitura Technical Forum [mailto:forums-technical@tessituranetwork.com] On Behalf Of Triland McConico Sent: October-26-12 4:40 PM To: Fernando Margueirat Subject: RE: [Tessitura Technical Forum] Order By Command Not Working
Still would not go. I did it just as shown.
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
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
The code in the comp_code area got corrupted; replace <> with <>
From: Tessitura Technical Forum [mailto:forums-technical@tessituranetwork.com] On Behalf Of Triland McConicoSent: Friday, October 26, 2012 5:32 PMTo: Lucie SpielerSubject: RE: [Tessitura Technical Forum] Order By Command Not Working
From: Tessitura Technical Forum [mailto:forums-technical@tessituranetwork.com] On Behalf Of Lucie SpielerSent: Friday, October 26, 2012 3:05 PMTo: Triland McConicoSubject: RE: [Tessitura Technical Forum] Order By Command Not Working
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 PMTo: Doug JonesSubject: RE: [Tessitura Technical Forum] Order By Command Not Working
That’s what it was. Thank you so much!!!!!!
From: Tessitura Technical Forum [mailto:forums-technical@tessituranetwork.com] On Behalf Of Doug Jones Sent: Friday, October 26, 2012 4:34 PM To: Triland McConico Subject: RE: [Tessitura Technical Forum] Order By Command Not Working
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