我想寫一個查詢,就像我想用Available替換列值,否則不可用。如何替換Sql中select語句中的列值?
select CandidateID,ResumeName from dbo.Tbl_Candidates
where CreatedBy=UserId order by CandidateID DESC
在這種情況下,如果ResumeName不是空的,我想替換爲可用else不可用。這有助於我得到這個。提前致謝。
我想寫一個查詢,就像我想用Available替換列值,否則不可用。如何替換Sql中select語句中的列值?
select CandidateID,ResumeName from dbo.Tbl_Candidates
where CreatedBy=UserId order by CandidateID DESC
在這種情況下,如果ResumeName不是空的,我想替換爲可用else不可用。這有助於我得到這個。提前致謝。
select CandidateID, case when ResumeName = '' Then 'Not Available' Else 'Available' End as Availability
from dbo.Tbl_Candidates
where CreatedBy=UserId
order by CandidateID DESC
select CandidateID,
case
when ResumeName is null then 'Not Available'
when ResumeName = '' then 'Not Available'
else 'Available'
end as ResumeName from dbo.Tbl_Candidates
where CreatedBy=UserId order by CandidateID DESC
SELECT CandidateID,CASE WHEN ISNULL(ResumeName,'') = '' 'Not Available' ELSE 'Available' END AS ResumeAvailability from dbo.Tbl_Candidates
where CreatedBy=UserId order by CandidateID DESC
select CandidateID,ISNULL(ResumeName,'Not Available') as ResumeName
from dbo.table
where CreatedBy=UserId order by CandidateID DESC
這是工作的罰款。非常感謝你 – Vetri 2014-08-27 10:54:05