Click here to Skip to main content
15,891,607 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
SQL
SELECT Diw_Tb_Court.Fd_CourtCode,Diw_Tb_Court.Fd_CourtName + ' '+ Diw_Tb_CourtType.Fd_CourtType AS Court from  table1 one inner join table2 to etc.....





i want when he found Diw_Tb_CourtType.Fd_CourtType =null get Diw_Tb_Court.Fd_CourtName as Court but in sql server when he find Diw_Tb_CourtType is null then result or court= null although Diw_Tb_Court.Fd_CourtName= 'damam'
Posted

1 solution

SQL
select isnull(Diw_Tb_CourtType.Fd_CourtType, Diw_Tb_Court.Fd_CourtName) as Court from  table1


or

SQL
select coalesce(Diw_Tb_CourtType.Fd_CourtType, Diw_Tb_Court.Fd_CourtName) as Court from  table1
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900