samedi 9 mai 2015

how to sort a table in sql?

I have the following table:


Table 1
Row+volume+part 1+part 2+part 3
1:520:2:5:3
2:1020:3:6:7
3:100:1:9:2
4:200:9:2:1

Now I want the table above (Table 1), the following conditions would sort: First, most of the times was produced and arranged by the volume the show in the first record. Then, sort by parts 1 then part 2 and then part 3. the output table was as follows:


Table 2
Row+volume+part 1+part 2+part 3
2:1020:3:6:7
4:200:9:2:1
3:100:1:9:2
1:520:2:5:3

If I'm sort of on the volume then part 1 and part 2 and part 3 of the first column of the table in terms of order volume and then the rest of the items practices sort you are the created table below (Table 3).


Table 3
Row+volume+part 1+part 2+part 3
2:1020:3:6:7
1:520:2:5:3
4:200:9:2:1
3:100:1:9:2
While i want table 2 as a output.

please help me.

Aucun commentaire:

Enregistrer un commentaire