This is my oracle query
select 0 subcatg_cd, 'all' subcatg_name from dual
union
select subcatg_cd,subcatg_name from datacontext.subcatg_mst
order by 1
I want to insert 0 & all at index 0 of the result of second query using linq. I want 开发者_JS百科to achieve it by a single query. How can it be done?
I think best option will be to query rest of the data (second sentence) and then join them on client side.
So:
class Subcat
{
public int subcatg_cd;
public string subcatg_name;
}
then
new Subcat[] { new Subcat() { subcatg_cd = 1, subcatg_name = "All" } }
.Concat(
datacontext.subcatg_mst
.Select(s => new Subcat() { subcatg_cd = s.subcatg_cd, subcatg_name = s.subcatg_name })
.OrderBy(s => s.subcatg);
);
精彩评论