Showing posts with label descending. Show all posts
Showing posts with label descending. Show all posts

Friday, March 30, 2012

Order Date prompt descending doesn't work

Hi,

In the report model I'm defining attribute date as ValueSelection: dropdown and SortDirection: Descending.

In the report builder I define the field as a prompt.

When I execute the report the values in the prompt date are order ascending and not descending.

This occur all over my model, can't order date field as ascending.

Any idea?

Thanks,

Assaf

In the report builder: There is a button "Sort and Group". Did you set the "Sort by" property of the date? I think that has to be set in order to sort right.|||

Hi,

Thanks for your reply.

The "Sort by" sort the records on the report.

My problem is that the sort in the prompt itself is always stay ascesnding although in the .NET I set it to descending

Any Idea?

Assaf

sql

Friday, March 23, 2012

ORDER BY DESC

I want to select 3 columns so that the result set is sorted descending on
each column. But this doesn't seem to get me the results that I want:
SELECT col1, col2, col3
FROM tbl1
ORDER BY col1, col2, col3 DESC
And this does not work (syntax error):
...ORDER BY col1 DESC, col2 DESC, col3 DESC
Peace & happy computing,
Mike Labosh, MCSD
"When you kill a man, you're a murderer.
Kill many, and you're a conqueror.
Kill them all and you're a god." -- Dave MustaneMike,
This should work:
> ...ORDER BY col1 DESC, col2 DESC, col3 DESC
Can you show the actual query?
Andrew J. Kelly SQL MVP
"Mike Labosh" <mlabosh@.hotmail.com> wrote in message
news:urUl$OLBGHA.3164@.TK2MSFTNGP10.phx.gbl...
>I want to select 3 columns so that the result set is sorted descending on
>each column. But this doesn't seem to get me the results that I want:
> SELECT col1, col2, col3
> FROM tbl1
> ORDER BY col1, col2, col3 DESC
> And this does not work (syntax error):
> ...ORDER BY col1 DESC, col2 DESC, col3 DESC
> --
> Peace & happy computing,
> Mike Labosh, MCSD
> "When you kill a man, you're a murderer.
> Kill many, and you're a conqueror.
> Kill them all and you're a god." -- Dave Mustane
>|||> This should work:
Whoops! Nevermind, you are correct. One of the commas in the order by
clause was acidentally a decimal.
Peace & happy computing,
Mike Labosh, MCSD
"When you kill a man, you're a murderer.
Kill many, and you're a conqueror.
Kill them all and you're a god." -- Dave Mustane

Wednesday, March 21, 2012

Order By

Is there a way to order data how you want besides Ascending or Descending? Example: I have M-F I need to sort in order of Monday-Friday.

Hi,

you could split up the queries to execute one for Monday, Tuesday... Friday. Then you can process the result sets in the order you want.

Otherwise I would store ordinals in the database like Monday = 0, Tuesday = 1 and so on.

--
SvenC

|||I don't quite understand could you send me a breif example?|||

Hi,

instead of using one SqlCommand with an order by clause you could set up one SqlCommand which selects only rows where Day = Monday, a second SqlCommand which selects Day = Tuesday and so on. So you end up with one DataSet or DataTable per day.

Otherwise you would have to modify the table to change how your day is represented. Change it from varchar to int, and store 0 instead of 'Monday' and 1 instead of 'Tuesday', so the numbers sort like you want the days to sort.

Does that help you?

--
SvenC

|||Yeah thats a good Idea I do have it store as 1's and 0's, and am combining as with case command as the day value. Thanks