SELECT Ad.Id, Newspaper, 4 n( Y. P7 y) Z3 L8 J
(select Organization from JobOrganization where JobOrganization.Id = Ad.OrganizationId) as Organization,( T% W& t7 m6 L! V& z
Ad.PublishDate, Ad.LastDate,Ad.Url, Job.Id as JobId,' U$ _) u' \* c% ]! h/ {
(select JobTitle from JobTitle where JobTitle.Id = Job.TitleId) as JobTitle1,9 _! O8 k0 A/ `# m
QualificationId, ExpInYears, CategoryId 7 R v$ |9 S% [. H- } FROM Ad inner join Job on Ad.Id = Job.AdId ' ?) Q' H: ?3 G9 b5 g5 } Where JobTitle1 Like @title or @title is null* M9 } r$ `( u+ Z+ w% h
Order by; }: ?8 v& b# [( n
case When @sortCol='PublishDate' and @sortDir='ASC' Then Ad.PublishDate End ASC," u. @0 a: C7 g# L- U; _
case When @sortCol='PublishDate' and @sortDir='DESC' Then Ad.PublishDate End DESC, - ^; \% } {6 H- W0 @9 @ case When @sortCol='LastDate' and @sortDir='ASC' Then Ad.LastDate End ASC, ( R; s5 D% W. t: c$ @* s$ w case When @sortCol='LastDate' and @sortDir='DESC' Then Ad.LastDate End DESC' m* p8 D# V }# a) ~8 P
错误:列名’JobTitle1’无效。' }5 S. Z* I5 F- p
我正在使用SQL-2008 ' p m5 P/ u0 t) B 9 L: g) [. s9 ?1 U; F* ^ 解决方案: