Narasiman nar

Narasiman nar

  • NA
  • 64
  • 22.5k

In sql query how to get my excepted output

May 22 2018 8:29 AM
   Query as follows
 
   SELECT REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(A.farm_detailsdata,'{',''),'}',''),'"',''),'',' '),',',' ') as farmdetailsdata,
A.farmer_season,A.farmvisitno,'-' as farmpicture
FROM dbo.tbl_farmer_farmdetails A
INNER JOIN dbo.tbl_farmerregistration B ON B.farmerctscode = A.farmer_id
 
WHERE B.farmerseason = '2018'
 
 
 When i execute the above query shows output as follows
 
 farmdetailsdata                     Season    farmvisitno  farmpicture   (Column Name)
 product1:A  product2:B           2018        1                     -                    (Values)
 
  from the above i want prodcut1 in each column A in each column product 2 in each column B in each column
 
 
 From the above i want  excepted output as follows
 
      product1        Product2       Season      farmvisitno   farmpicture    (Column Name)
          A                      B                2018           1                   -                     (Values)
 
 
 in the above sql query what changes i have to made to get  excepted output.
 
 please help me.
 
 
   

Answers (2)