Hi all
I have the following CTE. Its purpose is to provide unique Month/Year pairs. Later code will use the CTE to produce a concatenated string list of the Month/Year pairs.
;WITH tblStoredWillsInPeriod AS
(
SELECT DISTINCT Kctc.GetMonthAndYearString(DateWillReceived) Month
FROM Kctc.StoredWills
WHERE DateWillReceived BETW...
I have the following query
SELECT * FROM invoice WHERE invoice_id IN (13, 15, 9, 27)
My result is:
invoice_id | invoice_number | ...
------------------------------------
9 | 201006003 |
13 | 201006020 |
15 | 201006022 |
27 | 201006035 |
which is the result set I want except that ...
Hi all,
Any idea on how to order the results of a MYSQL query by the sum of two columns rather than by a single column?
Select * FROM table ORDER BY (col1+col2) desc
I know that won't work., but I hope it conveys what I want to do fairly well.
Thanks!
...
.OrderBy(y => y.Year).ThenBy(m => m.Month);
How to set descending order?
EDIT:
I tried this:
var result = (from dn in db.DealNotes
where dn.DealID == dealID
group dn by new { month = dn.Date.Month, year = dn.Date.Year } into date
orde...
Hello,
I have a table containing last_updated_1 and last_updated_2 columns, used respectively for text and images update time on a post.
I wish I could get a result set of 10 rows based on all time last updated records contained in the 2 columns, ex. row 1 = last_updated_1 record, row 2 = last_updated_2 record, row 3 = last_updated_1 r...
Hi,
I have created a function that has the follwing parameter:
List<Expression<Func<CatalogProduct, bool>>> orderBy = null
This parameter is optional, If it is filled it should create a order by and than by constuction for me, so that I can order the result on the SQL server.
I tried:
IOrderedQueryable temp = null;
...
I am trying to order a list of products based on the zindex property of the cross reference table with the category table (in this case called 'Chassis'), but I get the following error:
Cannot order by type 'System.Collections.Generic.IEnumerable`1[System.Int32]'.
The following is the method I am using:
public IQueryable<E_Product> Pr...
I'm starting to work with MongoDB and NoRM and I would like to do an orderBy that is not Ccase sensitive, is it possible?
Thanks for the help!
...
We have a stored procedure where we want to dynamically let the user choose which column to sort the result by, and in which order (ascending/descending). Currently, we have the following ORDER BY clause, but I'm sure it can be optimized. How?
ORDER BY
CASE WHEN @OrderBy = 'salvnummer' AND @OrderByDirection = 'DESC' THEN salvnummer ...
The error message I receive is:
At least one object must implement IComparable
The code causing this is below:
private static IEnumerable<Result> setOrderBy(IEnumerable<Result> value, string order)
{
if (order.Equals("ASC"))
{
//value = value.OrderBy(c => c, new SearchService.ResultComparer<Attribute>());
value...
To take it down to brass tacks, I have a List containing 100 various records. A Car has a Year, Make and Model.
I need to be able to :
order this according to Year, but I need to:
have all Cars that are Ford
Explorers appear as a "group" at the
end of my List (also ordered
according to Year)
I'm not sure if I'll have to...
Ok, so here's the issue. Currently I'm using the symfony framework to develop a web app. I'm using MySQL in the backend but want to keep my queries in their doctrine format to avoid any problems if I ever need to change databases.
In one section of the web application I'm looking for the last comment associated by any distinct user, s...
Will the order of the record retrieved using a select query, be in the same order if retrieved infinite number of times, each time using a new connection? (to the same table, same select)
What order method is used when none is specified?
...
I want to sort by an column of ints ascending, but I want 0 to come last. Is there anyway to do this in MySql?
...
Hi all, I have a query that I want to sort alphabetically, but the trick is that I want the sorting to treat two columns equally. For instance, if the first row of first_col equals apple and the second row of second_col equals aardvark I want the value in the second row of second_col to be listed before the value in the first row of fir...
SELECT DISTINCT rt . d_rev_id , rt . d_rev_code , rt . d_reason , rt . d_rev_status , rt . d_apb , rt . d_cb , pt . d_partid , pt . d_part_no , pt . d_ab , pt . d_abd , pt . d_status , rt . d_part_name , rt . d_part_desc , rt . d_part_type , pnv . d_pn_val , pnv . d_pn_id , cfv . d_optionname , rt . d_projectid , rt . d_abd , rt . d_apbd...
How do you order by number if your number can fall below and be bigger than 0?
Example Mysql table:
|Name|Karma|
__________
|Me | -8 |
|Bill| 5 |
|Tom | 2 |
|Saly| 0 |
|San.| -3 |
Example select query
$sql="SELECT karma FROM table ORDER BY karma DESC";
The result I get is this (separated by comma): 5,2,0,-8,-3.
Shouldn't...
I want to lock one record in a table.
The record is specified as "the next that has ID greater than..."
CREATE TABLE test (id number);
SELECT id
FROM (SELECT id
FROM test
WHERE id > 10
ORDER BY id)
WHERE ROWNUM = 1
FOR UPDATE;
This seems intuitive and easy. But it is not. Any ideas?
P.S.
I do need the existing qu...
i have a collection of objects and i am looking to sort by a property that is a DateTime?
list.OrderBy(r => r.Milestone)
where milestone is a:
public DateTime? Milestone { get; set; }
it seems to put all of the items with novalue at the top of the sort. Is there anyway to sort by date but put the empty items at the bottom of t...
I want to use OrderBy in SPSiteDataQuery to sort items by data, however, the field containing the date differs between the content types.
Can this be solved by sorting with a calculated field? I am currently trying to create a calculated field that checks for existence of a field (using ISERROR), if it is found it returns the value, oth...