0

I have a query with a group_concat in it but it returns an error that the group_concat is not a built in function. Please help me to resolve this. My query is like this:

 SELECT cast(user_id as varchar(255)) AS member_id,skincareproductbarcode.barcode, skincareproduct.SCP_id, skincabinet.beautybox_id,  
        skincabinet.skpid, skincareproduct.photos, skincabinet.create_date, GROUP_CONCAT(MirrorProfile.serial_number, '') As Serial_Number
         from skincabinet join skincareproduct on skincareproduct.scp_id = skincabinet.skpid 
         full join skincareproductbarcode on skincabinet.skpid = skincareproductbarcode.scp_id
          full join membermirrorprofile on skincabinet.user_id = membermirrorprofile.member_id
           full join mirrorprofile on MemberMirrorProfile.mirror_id = mirrorProfile.mirror_id 
             where skincareproduct.approval_flag = 'N' and skincareproduct.photos != '' 
             and substring(photos,52,3) = 'scp' order by skincareproduct.SCP_id  group by skincareproduct.scp_id desc

How can I use group_concat or is there any other way around?

bleyk
  • 799
  • 3
  • 14
  • 41
  • group concat is not a ANSI sql function.. it exists in mySQL but not sure it exists in any other db. – Steven Aug 16 '17 at 04:02
  • 1
    try this https://stackoverflow.com/questions/17591490/how-to-make-a-query-with-group-concat-in-sql-server – Harry Aug 16 '17 at 04:22

1 Answers1

0

the concat of fields should not be the output of the SQL query. It is not made for that. Use the tool which receive the data to make this action.

Steven
  • 14,048
  • 6
  • 38
  • 73
  • what kind of tool? – bleyk Aug 16 '17 at 04:34
  • how do you use the data ? in excel? in reporting tool? in website with php? im talking about this data receiver interface. – Steven Aug 16 '17 at 04:35
  • I using the data on my webpage and display it on a table – bleyk Aug 16 '17 at 04:41
  • then you should think how to perform that with your webpage code. That is the best practice way to do it. But if really you want SQL, there are some ways ... which may result to performance issues most of the time. – Steven Aug 16 '17 at 04:42
  • I don't know how can I perform that with my webpage code can you give me an idea? – bleyk Aug 16 '17 at 04:55