Hi all I am using the following query for data to be displayed in crosstab : SELECT closedate,status, SUM (CASE WHEN empcode = 'NT-028' THEN 1 ELSE 0 END) AS NT028, SUM (CASE WHEN empcode = 'NT-031' THEN 1 ELSE 0 END) AS NT031, SUM (CASE WHEN empcode = 'NT-050' THEN 1 ELSE 0 END) AS NT050, SUM (CASE WHEN empcode = 'NT-062' THEN 1 ELSE 0 END) AS NT062 FROM dbcleaning WHERE status = 'Fixed' AND empcode IN ('NT-028', 'NT-031', 'NT-050', 'NT-062') GROUP BY closedate, status Now i need a column in the same result of the query which shows the difference between the two columns . For Example : the result shoud be Closedate , status , NT028, NT031, NT050,NT062 , NT028-NT031 Please note the last column in bold, i need the difference . Any help will be highly appreciated -- View this message in context: http://old.nabble.com/SQL-Query-Help-Please-%21-tp29082529p29082529.html Sent from the PostgreSQL - general mailing list archive at Nabble.com. -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general