lundi 11 janvier 2016

mysql if condition add value else add value1

I'am trying to get total full time and total half time by user, Timing is stored in single column, Integer value of timing should come in full time as sum(timing) and floating value in half time but in count

id user_id timing
1   2       1
2   2       2.5
3   1       1.5
4   1       1
5   3       3
6   2       2.5

I need the result as

 user_id  fulltime halftime
   1        2         1
   2        5         2
   3        3         0

Aucun commentaire:

Enregistrer un commentaire