Skip to content
Advertisement

How can I concat these two rows in a SQL table?

I have the following data in a single table:

enter image description here

I need a SQL query that can combine the data to append url1 to the batch row and url2 to the single row. Could I use the KNO column to create some sort of matching information?

Result:

enter image description here

Advertisement

Answer

I found another solution using INNER JOIN. I modified the kno column of the “applyPages” Rows to contain the corresponding process name, then I joined them on that column:

SELECT kname, kno, kvalue, url 
    FROM (SELECT kname, kvalue FROM mytable WHERE kname='ProcessName%') A 
    INNER JOIN (SELECT kname,url, kno FROM mytable WHERE kname='ApplyPage') B 
    ON A.kname = B.kno
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement