jeudi 21 juillet 2016

SQL Server Query to compare 2 select statements data

Can you please help me in combining the below 2 queries. The result should be as shown in attached image. I would like to compare the balance between 2 queries and flag the balance when state balance is less than city balance. select CT_ID, sum(balance) as StateBalance from tblApp where StateJurisdiction='New york' group by CT_ID order by CT_ID select CT_ID, sum(balance) as CityBalance from tblApp where StateJurisdiction in ('BRONX','BROOKLYN') group by CT_ID order by CT_ID

Aucun commentaire:

Enregistrer un commentaire