Find Out the total no of Accounts segregated on the basis of account type person.
create table bank(branch_no varchar(95),acc_type varchar(20),
tot_accounts int)
insert into bank values('A1','Fixed',20)
insert into bank values('A1','Deposit',5)
insert into bank values('A1','Fixed',10)
insert into bank values('A2','Fixed',20)
insert into bank values('A2','Deposit',10)
select branch_no,acc_type,SUM(tot_accounts) from bank GROUP BY branch_no , acc_type
Result is coming out to be-
A1 Deposit 5
A2 Deposit 10
A1 Fixed 30
A2 Fixed 20
I want first all the accounts of branch A1 are shown then Branch A2.
I want as follows-
A1 Deposit 5
A1 Fixed 30
A2 Deposit 10
A2 Fixed 20