mysql select condition with 3 conditions -


i have table have field called cheque_type , filed comes 3 variables such life,nonmotor,motor

and table has time stamp. need result how many life, nonmotor , motors checks printed

what need add 3 columns sql query , number of results according category

select date(`timestamp`) ___date___, count(`id`) total, sum(print_status) printed, (count(`id`) - sum(print_status)) to_be_print cheque.vouchers date( `timestamp`)  >='2014-11-15' , date( `timestamp`)  <='2014-11-31' group date(`timestamp`) ; 

enter image description here

select date(`timestamp`) ___date___,        count(`id`) total,        sum(print_status) printed,        (count(`id`) - sum(print_status)) to_be_print,        sum(cheque_type = 'life') life_check,        sum(cheque_type = 'nonmotor') non_check,        sum(cheque_type = 'motor') motor_check cheque.vouchers date( `timestamp`)  >='2014-11-15' , date( `timestamp`)  <='2014-11-31' group date(`timestamp`) ; 

Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -