質問があります:
select * from
(
select i.id, i.art_id, i.c_izm, i.c_zime_izm, i.ac_izm, i.rc_izm, i.f_nos, convert(nvarchar,dateadd(mi,-30,i.datums),100) as dat
from nol_art_izmaina i
inner join nol_art a on i.art_id=a.id
where datepart(year,print_dat)=2005
order by a.nos --when I add this row, the error shows
union all
select distinct null,null,'','','','', f_nos, min(dat)
from nol_art_izmaina
where datepart(year,print_dat)=2005
group by f_nos
)tablePlusHeaders
order by dat desc
私が必要なものは何?最初のクエリのデータはa.nos値で並べ替える必要があります。それ、どうやったら出来るの?
編集
結果テーブルは次のようになりますが、私のデータのみが含まれます。
Name ImpFile/Job Year
--------------------------------
Imp01 20.01.2012 This is from set2
John Clerk 1986 This is from set1
James Assistant 1990 This is from set1
Imp02 26.02.2012 This is from set2
Anna Manager 1982 This is from set1
Sam Salesman 1985 This is from set1
Dean Cleaner 1985 This is from set1