I have a table called vendors which have two field ven_txt_CompanyName and ven_txt_VendorName.
I have always some value for ven_txt_VendorName but ven_txt_CompanyName sometimes has value as NULL ,
or it have no value or sometimes it has value.Something like this.
ven_txt_CompanyName ven_txt_VendorName
Gift Emporium Mcpartland, Sandy
NULL Nicholson, Don
Jacks Wholesale Varela, Jimmy
Goggins, Jerry
NULL Swinson, Billy
Dee, Teresa
NULL Olsen, Ysa
So what I have to do is if ven_txt_VendorName is null or it contains blank value replace it with corresponding
ven_txt_CompanyName value else ven_txt_CompanyName value will remain as it is.
Milton SmithPosted Jun 9, 2008, 9:59 AM
Niradhip ChakrabortyPosted Jun 9, 2008, 9:31 AM
Use Case statement only:
Select case usr_int_Type when 2 then 'Floor Person' when 1 then 'Admin' when 3 then 'Technical' end as 'EmployeeType' FROM Users
Milton SmithPosted Jun 9, 2008, 9:13 AM
Thanks James it is working fine. Another Doubt!!!!1
I have a table as Users where I have a field called usr_int_Type,which contains value as 1 or 2 or 3.
what I want is if it is 1 it should display as Admin, 2 - Floor Person and 3 Technical
Niradhip ChakrabortyPosted Jun 9, 2008, 9:05 AM
Use case statement:
SELECT Vendors.ven_txt_VendorName,case when Vendors.ven_txt_CompanyName is null or Vendors.ven_txt_CompanyName = '' then Vendors.ven_txt_VendorName else Vendors.ven_txt_CompanyName end as CompanyName from Vendors