5 Replies Latest reply on Mar 2, 2017 1:32 AM by aftab.najib

    How to Concat in Custom SQL Query

    aftab.najib

      Hi, I am currently trying to join 2 tables together but I have ran into an issue. Currently the first table shows me a list of students that have done their tests and the second table shows me the full class list of students and I have now joined these using the Full Outer Join as I need to do a calculation to divide the number of tests by the number of students per class.

       

      The problem I have is that my second table has the names as Forename and Surname so I wrote a custom query to join the 2 fields:

       

      SELECT CONCAT(FORENAME, SURNAME)
      

       

      but this doesn't add a space and I have tried adding the pipe characters like the following:

       

      SELECT CONCAT(FORENAME || ' ' || SURNAME)
      

       

      but this gives me an error and I am not sure how to fix this as I want to ensure the join is done by the name on both sides and the remaining names with no tests will also show up.

       

      If somebody could please advise where I am going wrong.