mardi 22 avril 2014

SQLite "split" row into multiple rows


Vote count:

0




Is there a way to "split" one row into multiple rows?


My problem is that I have table of edges where patternID is the id of the edge and sourceStationID and targetStationID are the ids that the edge connects:


Patterns:



patternID | sourceStationID | targetStationID
1|1|2
2|1|6
3|1|3
4|1|4
5|4|6
6|5|6


I also have table of Hubs where I can transfer:


Hubs:



hubID
4
5


I need to get out of those data patternIDs that connect stations 1->6 exactly via one hub. So the result of query should be:



4
6


I did that by joining patterns table with hubs table and again with patterns table so i get:



patternID | sourceStationID | targetStationID | patternID | sourceStationID | targetStationID
4 | 1 | 4 | 5 | 4 | 6


How can I split this row into two rows?



asked 2 mins ago






Aucun commentaire:

Enregistrer un commentaire