kaushik guru

kaushik guru

  • NA
  • 252
  • 30.5k

cast function in sql

Aug 27 2020 10:57 AM
I am trying to print a report based on the status of a column from sql if it is like 'P' it should be return some text if the column value is something else if should return a specific column
 
SELECT a.PAYMENT_ID, a.CONTRACT_CODE,a.PAYMENT_AMOUNT,a.GST_AMOUNT,
 a.TOTAL, a.PAYMENT_DATE,a.Paid_Amount,a.INITIATED_DATE,upper(NAME) NAME,a.CCY,UPPER(a.REMARKS) REMARKS
 ,a.Vendor_Inv_No as InvoiceNo,  
   b.Contract_Amount as FreeText1,
 c.User_LoginName as FreeText2, c.User_CreatedOn as FreeText3,
 case when a.Row_Status = 'P' then a.Modified_by = 'Yet To Be Authorised' else a.Modified_by end
 
 FROM PAYMENT_MASTER  a
 LEFT OUTER JOIN TBL_DMSSUPPLIERS ON VENDOR_ID = CODENO
 join contract_master b on b.Contract_id = a.Contract_code
 join TBL_DMSUSERS c on c.User_Id = a.Created_by
 join budget_master d on d.Budget_id = a.Budget_Code
 
 i am unable to figure where i went wrong kindly guide
 
 

Answers (2)