Home > Archive > MS SQL Server Reporting Services > June 2005 > Sort on calculated field









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Sort on calculated field
Jack Nielsen

2005-06-29, 3:23 am

I have made a report and now I need to sort on a calculated field where i
subtract 2 database fields, and i only want the 20 higest.

I'm new at this and appriciate any helt I can get, thank you !

Jack


Dan Christjohn

2005-06-29, 3:23 am

Well if you are talking about doing that in the select it would go something
like this I believe:

SELECT TOP 20
(myfield1-myfield2) as mynewfield
FROM
mytable
WHERE
mycriteria
ORDER BY
mynewfield DESC

If I didn't understand your question correctly let me know.

Peace,

Dan

"Jack Nielsen" <nospamjackd@jackd.dk (Fjern nospam)> wrote in message
news:egFt4OHfFHA.2424@TK2MSFTNGP09.phx.gbl...
> I have made a report and now I need to sort on a calculated field where i
> subtract 2 database fields, and i only want the 20 higest.
>
> I'm new at this and appriciate any helt I can get, thank you !
>
> Jack
>
>



Jack Nielsen

2005-06-29, 7:23 am

Thanx, I will try that, didn't knew that I could create a new field in the
statement, learning every day :)

Jack

"Dan Christjohn" < dchristjohn(removeth
is)@directapps.com> skrev i en
meddelelse news:eVZ7RvHfFHA.3916@tk2msftngp13.phx.gbl...
> Well if you are talking about doing that in the select it would go

something
> like this I believe:
>
> SELECT TOP 20
> (myfield1-myfield2) as mynewfield
> FROM
> mytable
> WHERE
> mycriteria
> ORDER BY
> mynewfield DESC
>
> If I didn't understand your question correctly let me know.
>
> Peace,
>
> Dan
>
> "Jack Nielsen" <nospamjackd@jackd.dk (Fjern nospam)> wrote in message
> news:egFt4OHfFHA.2424@TK2MSFTNGP09.phx.gbl...
i[color=darkred]
>
>



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com