SELECT Ad.Id, Newspaper, ) [" t$ O- g% | P! H
(select Organization from JobOrganization where JobOrganization.Id = Ad.OrganizationId) as Organization,- g' D ]7 R6 a: F; m) O6 j
Ad.PublishDate, Ad.LastDate,Ad.Url, Job.Id as JobId,0 h6 B0 m6 }9 ~6 T! B- `& @$ z n( y
(select JobTitle from JobTitle where JobTitle.Id = Job.TitleId) as JobTitle1,5 v. [+ h; e% t: l* f
QualificationId, ExpInYears, CategoryId# ?8 d4 D& `' x! L
FROM Ad inner join Job on Ad.Id = Job.AdId8 e- R4 Y& T5 U7 A% O$ R" G. X" l
Where JobTitle1 Like @title or @title is null ) W7 E6 j$ M8 Y0 w* L: m- U' n Order by& j, v- l, A8 g* Y6 m
case When @sortCol='PublishDate' and @sortDir='ASC' Then Ad.PublishDate End ASC,4 J8 B% s! D# o7 f5 m* C
case When @sortCol='PublishDate' and @sortDir='DESC' Then Ad.PublishDate End DESC, . K- x$ B" G% W: D+ F- E9 | case When @sortCol='LastDate' and @sortDir='ASC' Then Ad.LastDate End ASC,$ G7 b c" H- y3 V9 D
case When @sortCol='LastDate' and @sortDir='DESC' Then Ad.LastDate End DESC& ]' E$ a1 |1 O( ^4 y+ f
错误:列名’JobTitle1’无效。 % ]8 t6 R7 D8 }8 ~& J0 c* h1 B我正在使用SQL-2008# F: Z2 K# K/ E- D" q
7 E9 X7 A# d3 r/ q! m" B! ]; k' ?* j 解决方案: