|
How come in my code when i use @"select Score from tblMed order by Score desc limit 10" everything works fine, but when I change "desc" to "asc" the scores don't show up???
Started by Steve on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Because:
ORDER BY score ASC
...means.
Do you have NULL scores in your records?
If you change the ordering to asc, then it would start with NULLs before selecting records with an actual value.
|
|
I have a generic collection of type MyImageClass, and MyImageClass has an boolean property "IsProfile". I want to sort this generic list which IsProfile == true stands at the start of the list.
I have tried this.
rptBigImages.DataSource = estate.Images...
Started by Barbaros Alp on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
You can use .OrderByDescending(...) - but note that with....
How about:
estate.Images.OrderByDescending(est => est.IsProfile).ToList()
This will order the Images in descending order by the IsProfile Property and then create a new List from the result .
|
|
I've got a report being built from a dataset. The dataset uses the Sort property to order the data. I know that I can create a sort expression like this:
"field desc, field2 asc"
But what I need now is a way to do a custom sort. In SQL, I can perform ...
Started by Chu on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
If (Something == "1") MyView.Sort = "Field1 ASC"; else MyView.Sort = "Field2 ASC";
OR
switch (MyProperty) { case 1: MyView.Sort = "Field1 ASC"; break; case 2: MyView.Sort = "Field2 ASC"; break; default: MyView.Sort = "Field....
|
Ask your Facebook Friends
|
I want to to make to make the ordering in my query conditional so if it satisfiess the condition it should be ordered by descending
For instance:
SELECT * FROM Data ORDER BY SortOrder CASE WHEN @Direction = 1 THEN DESC END
Started by Shimmy on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
SELECT....
Then InventoryCount else -InventoryCount end as "SortOrder" order by 3
Don't change the ASC or DESC THEN -id else id END asc;
The OP asks:
Guys, I am not the SQL Expert, please explain me what means the id that may help.
|
|
I am working off this example.
http://www.drury.net.nz/2005/04/15/specifying-a-sort-parameter-for-a-tsql-stored-procedure/
CREATE PROCEDURE getEmployees ( @ColumnName varchar(100) ) AS SELECT EmployeeID, FirstName, LastName, SSN, Salary FROM Employees...
Started by Brennan on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
Then Forename When 3 then Telephone_Number else '' end asc, Case @Sort When 4 then Personnel_Ref When 5 then timesheet_number When 6 then Telephone_Number Else '' End desc
(I don't have enough.
|
|
Hi,
How shall sort this in ASC order?
I got List<List<UInt32>> full of records of List<UInt32> and I want those records to be sorted according to the first column in each record - the column is UInt32 number.
So:
I have List of:
new ...
Started by Skuta on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Nearly a duplicate of:
http://stackoverflow.com/questions/721577/how-to-sort-listliststring-according-to-liststring-number-of-fields
Something like:
var sorted = parent.OrderBy( l => l[0] );
Or:
parent.Sort( (a,b) => a[0].CompareTo( b[0] ) )
While... .
|
|
SELECT * FROM (SELECT ROW_NUMBER() over ( ORDER BY CASE WHEN @SortExpression ='Country_id' THEN Country_id END, CASE WHEN @SortExpression ='Country_name' THEN Country_name END, CASE WHEN @SortExpression ='Country_region' THEN Country_region END, CASE ...
Started by Sikender on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
asc' THEN Country_id ASC END, CASE WHEN @SortExpression ='Country_name' THEN Country_name DESC END ='Country_region' THEN Country_region DESC END, CASE WHEN @SortExpression ='Country_region_asc' THEN Country_region ....
|
|
Sorry for the long and bad title,. In the script below Im using glob to output wave files from a directory called audio. Currently I output 3 rows from the directory. They are filename, size and date. The script works fine as is but I want to add code...
Started by chrisdee on
, 15 posts
by 5 people.
Answer Snippets (Read the full thread at phpbuilder):
Now I need to some how use this to make the table titles , SORT_DESC );
echo "<table border='1'>" ;
echo "<tr>" ;
$table_titles = array( 'name.
I change SORT_DESC or SORT_ASC, so thats good.
|
|
Hi have a gridview with sortexpression setted in columns. If i click on column title the table is ordered by asc, if i click another time on title column the table doesn't change.
I want that on second click the table is ordered by desc.
How can i do ...
Started by Luca Romagnoli on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
See this Stackoverflow post, "Gridview sorting: SortDirection always Ascending" . .
Here is an article that can give you some ideas .
One way of doing it is to create an extension of the gridview .
|
|
I want to find the highest AutoIncremented value from a field. (its not being fetched after an insert where I can use @@SCOPE_IDENTITY etc) Which of these two queries would run faster or gives better performance. Id is the primary key and autoincrement...
Started by Binoj Antony on
, 8 posts
by 8 people.
Answer Snippets (Read the full thread at stackoverflow):
Also, this one is more extendable' SELECT TOP 1 id FROM master ORDER BY id DESC PRINT 'MAX' SELECT MAX(id) FROM master PRINT 'TOP 1' SELECT TOP 1 id FROM master ORDER....
FROM Table1 ORDER BY Id DESC
will more probably use a PRIMARY KEY INDEX .
|