If I have a structure like this
Albums
- Album
- Discs
- Tracks
and I want to order a collection of albums by the title of the first track on the first disc.
Is there something similar to the following I could do (keeping in mind I need to use the OrderBy extension method that accepts a string)?
alb...
I am trying to refer to a column name to order a query in an application communicating with an Oracle database. I want to use a bind variable so that I can dynamically change what to order the query by.
The problem that I am having is that the database seems to be ignoring the order by column.
Does anyone know if there is a particula...
Hi,
Ideally I want to do this:
UPDATE TOP (10) messages SET status=10 WHERE status=0 ORDER BY priority DESC;
In English: I want to get the top 10 available (status=0) messages from the DB and lock them (status=10). A message with a higher priority should be gotten first.
unfortunately MS SQL doesn't allow an order by clause in the up...
How can I use
ORDER BY
CASE @AccountOperator
WHEN '>' THEN AccountTrxValue
END ASC,
CASE @AccountOperator
WHEN '<' THEN AccountTrxValue
END DESC
when AccountTrxValue is an alias and a result of the following in the "select"?
CASE WHEN PAA.RedeemValue>0 THEN
PAA.RedeemValue * -1
ELSE PAA.EarnValue END
AS AccountTrxValu...
What is the best for sorting a data table in c#, both from a performance and a code-readability point-of-view:
personsDT.OrderBy(person => person.PersonName);
or:
personsDT.DefaultView.Sort = "PersonName ASC";
The personsDT is build from a SharePoint list, so it is impossible to use SQL (I am aware that an ORDER BY claude in a SQL ...
Hi, I am using NHibernate 2.0, and when I submit a request asking for the top 2 records to be returned, I get a number of ORDER BY clauses in my SQL. When I take out the Max results, the query looks fine (no ORDER BY statements). Why is NHibernate automatically adding this when I am looking for a subset of records? Thanks in advance ...
In SQLSERVER/MSSQL, here's the problem:
SELECT * from [Translation Color] order by [Language Code]
I want records ordered in alphabetical order starting by the 'I' letter.
Example of result:
'Ioren'
'Iumen'
'Tart'
'Arfen'
'Coldry'
I don't want to use union or more sql statements.. just try to catch it with an order by special claus...
Is there any more convenient way to compare a tuple of data in T-SQL than doing something like this:
SELECT TOP 100 A, B
FROM MyTable
WHERE (A > @A OR (A = @A AND B > @B))
ORDER BY A, B
Basically I'm looking for rows with (A, B) > (@A, @B) (the same ordering as I have in the order by clause). I have cases where I have 3 fields, but it...
Hi folks,
I have the following linq query, which works fine. I'm not sure how i order the group'd result.
from a in Audits
join u in Users on a.UserId equals u.UserId
group a by a.UserId into g
select new { UserId = g.Key, Score = g.Sum(x => x.Score) }
the results are currently ordered by UserId ascending. I'm after Score descending.
...
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
...
In MySQL, how can I order my query by character count?
...
Hi - I'm trying to create a collection of strings in an order defined by another array. Sounds confusing I know so let me explain
requiredOrderOfElements{
[0] category1,
[1] categoryX,
[2] something else
}
my client passes up a string array containing the key and value ie
passed from client
{
[0][0] categoryX,
[0][1] value from Catego...
I have a (C#) class called Hit with an ItemID (int) and a Score (int) property. I skip the rest of the details to keep it short. Now in my code, I have a huge List on which I need to do the following select (into a new List): I need to get the sum of all Hit.Score's for each individual Hit.ItemID, ordered by Score. So if I have the follo...
Hi,
I need to used dynamic order query in mysql and i have successfully achieved that through string concatenation in mysql as follows:
set @stmt_text := concat('select * from abc order by ',sorder);
prepare stmt_handle from @stmt_text;
execute stmt_handle;
deallocate prepare stmt_handle;
i need a similar way to convert this in mss...
I am using an objectdatasource with a gridview to get data from my orm class, but I cannot get it to order by properly.
I am using the code below but it does not come up in descending order like I have specified below. What am I missing? Using subsonic 2.1
<DataObjectMethod(DataObjectMethodType.Select, True)> Public Function FetchByP...
I want to order a resultset. The columns which i want to use for ordering contain german umlauts like ö, ü and ä. I want column data with these sortet together with normal letters.
Example:
At it the Moment, the resultset is ordered like this:
ABCOXYZÖ
I want it to be ordered like this:
ABCOÖXYZ
Thanks
...
I've always wondered about this, and now a client is wondering whether it's feasable:
I have a list of sports, broken down like such:
Boys Ice Hockey
Boys Tennis
Girls Ice Hockey
Girls Tennis
...etc
And they want it to sort like:
Boys Ice Hockey
Girls Ice Hockey
Boys Tennis
Girls Tennis
...etc
I'm just wondering if this i...
I have a table as below
Rate Effective_Date
---- --------------
5.6 02/02/2009
5.8 05/01/2009
5.4 06/01/2009
5.8 12/01/2009
6.0 03/15/2009
I am supposed to find the all rates that are effective for current date and after it. So to get the current effective rate, i use
SELECT TOP 1 * from table
where effective_date < '05/05/2009...
Hi folks,
I have some Linq code, that works fine. It retrieves a list of board posts ordered by the most recent.
The catch here is the order by ... it orders by the most recent COMMENTS. So if a board post just got a comment, then it will be up the top of the list (ie. most recent).
kewl ... but what about new board posts that just g...
I have a loooooooooooong SELECT ending with a ORDER BY that can include the following values :
checked (1 or 0)
date (YYYY-MM-DD)
time (HH:MM:SS)
I'd like to order the result of the query the following way :
|__checked = 0
| |__ date ASC
| |__ time ASC
| |__ date && time are null
|__checked = 1
...