dimanche 26 juillet 2015

SQLite. Add autoincrement as per group total

I need to run a sqlite query to get the a column added with a character to separate the groups.

Example: Need to add a symbol to every 20 lines in the group and if the total in the group is less than to 2 to add the same symbol. Is it also possible have it when there is say 21 in a group to make it group in 10 and then in 11 to complete the group? To try and minimize the singles lines.

Example database:

Line1|Line2|Line3|Line4|Line5
1|Sample|Sample|abc123|
2|Sample|Sample|abc123|
3|Sample|Sample|abc123|
4|Sample|Sample|abc123|
5|Sample|Sample|abc123|*
6|Sample|Sample|def123|
7|Sample|Sample|def123|
8|Sample|Sample|def123|*
9|Sample|Sample|geh123|*
10|Sample|Sample|hel123|*

Regards,
Adrian Herr

Aucun commentaire:

Enregistrer un commentaire