Search
 
SCRIPT & CODE EXAMPLE
 

SQL

Mysql Case sum

select sum(CASE WHEN payment_status = 'PAID' THEN paid_amount else 0 end) as paid,
       sum(CASE WHEN payment_status = 'Not Paid' THEN total_amount_due else 0 end) as due
from monthly_fee
Comment

PREVIOUS NEXT
Code Example
Sql :: how to list columns for particular tables in postgresql 
Sql :: sqlite alter table add column 
Sql :: tsql copy table 
Sql :: mysql change database charset and collation 
Sql :: how to change potgress password 
Sql :: sql query to get column data type in sql 
Sql :: how to install psql in ubuntu 
Sql :: sql first day of current year 
Sql :: mysql copy table with new name 
Sql :: how to stop all connections to a psql 12 database? 
Sql :: autoincrement sqlite command 
Sql :: convert_tz mysql 
Sql :: import sql mysql ubuntu 
Sql :: postgresql print sessions using the database 
Sql :: mysql last day of next month 
Sql :: revoke a role from user microsoft sql server 
Sql :: oracle create_program 
Sql :: su: Authentication failure mysql 
Sql :: sql server alter column 
Sql :: select dba users oracle 
Sql :: get permissions postgre query 
Sql :: mysql created at yesterdau 
Sql :: SQL Integer devision 
Sql :: mysql get first 2 characters of string 
Sql :: postgres killing connections on db 
Sql :: sql copy table structure 
Sql :: postgresql show current database 
Sql :: copy sql table to another table 
Sql :: install mysql in amazon linux 2 
Sql :: sql server list user permissions 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =