SELECT Ad.Id, Newspaper, a2 r" k$ G) |/ k( ?* Y3 _% J; h
(select Organization from JobOrganization where JobOrganization.Id = Ad.OrganizationId) as Organization, + a G- Q* h6 ~8 Q3 l- J( ?3 C" o Ad.PublishDate, Ad.LastDate,Ad.Url, Job.Id as JobId, % v& v! J6 F' z3 d' | (select JobTitle from JobTitle where JobTitle.Id = Job.TitleId) as JobTitle1, 0 @7 x/ U" d6 E/ O& b0 Y QualificationId, ExpInYears, CategoryId! D" \; Y/ p; J
FROM Ad inner join Job on Ad.Id = Job.AdId. Z1 M5 C/ m, f! P/ d
Where JobTitle1 Like @title or @title is null+ u$ @( k" u) O" v. w
Order by 0 t6 Y& \/ T' V case When @sortCol='PublishDate' and @sortDir='ASC' Then Ad.PublishDate End ASC,: ], `# C/ V/ R. q
case When @sortCol='PublishDate' and @sortDir='DESC' Then Ad.PublishDate End DESC, & e2 h/ z3 @1 d case When @sortCol='LastDate' and @sortDir='ASC' Then Ad.LastDate End ASC, " g2 W3 g5 A: g8 k5 @# T' s case When @sortCol='LastDate' and @sortDir='DESC' Then Ad.LastDate End DESC, {* k1 g/ ~) _, y8 k/ v
错误:列名’JobTitle1’无效。+ r) l% @5 G' s: u
我正在使用SQL-20080 E, l# i9 c3 J& G$ q
. v9 H( o6 H; _: D: A& g 解决方案: