I have query like this (select id, reffid, someData from myTable):
id reffid someData 8 10 text1 9 10 text2 10 11 text3 11 11 text4 12 11 text5 13 11 text6 14 12 text7 15 12 text8 16 12 text9 17 13 text10 18 14 text11
I need query which will do the following: if I have less than 4 reffid with same values, than add rows with same same reffid and in someData add -. Result query should look like this:
id reffid someData 8 10 text1 9 10 text2 ??? 10 - ??? 10 - 10 11 text3 11 11 text4 12 11 text5 13 11 text6 14 12 text7 15 12 text8 16 12 text9 ??? 12 - 17 13 text10 ??? 13 - ??? 13 - ??? 13 - 18 14 text11 ??? 14 - ??? 14 - ??? 14 -
How to accomplish that?