15,302,455 members
See more:
This is My table(Fee) Containing some Rows
```Id	Installment_No	Amount_Paid
1000	1	         6000
1000  	2	         6000
1001	1	         12000
1002	1	         6000
1003	1	         6000
1004	1	         6000
1005	1	         6000
1005	2	         6000
1006	1	         12000```

I just need a Query to get the Below output.

```Output
Id	Installment_No	Amount_Paid
1002	1	        6000
1003	1	        6000
1004	1	        6000```

Id "1000" had paid 12000 Rupees in Two Installments(So i don't want this)

and

Id "1001" had Paid 12000 Rupees in one Installment Only(this one also i don't need)

and

Id "1002" had Paid only 6000 rupees in 1st Installment need to pay remaining 6000 Rupees(I want this type Details)

I tried it but i couldn't get the Output.

Posted
Updated 6-Aug-13 2:37am
v2
Richard MacCutchan 6-Aug-13 8:38am

Maybe if you show what you have tried, and explain what is not working, then people will try to help you.
Venkat Kumar chigulla 6-Aug-13 8:43am

I tried this Query

select Admission_ID from Tution_Fee where Branch_Code='ap' and Amount_Paid!='12000' and Installment_No!=2 and Admission_ID in (

I got the Records who paid 12000.
Example: 1000 id will come in the output( He paid 12000)
Karwa_Vivek 6-Aug-13 8:59am

According to your Question you want the Records ,who have not paid there total Installments yet and who have to pay the Remaining Installments ,Right ??

## Solution 2

SQL
```SELECT * FROM FEE WHERE ID IN (SELECT id
FROM FEE
WHERE amt=6000
GROUP BY id
HAVING COUNT(id) = 1)```

Fiddle Example : http://www.sqlfiddle.com/#!3/87471/2
Venkat Kumar chigulla 7-Aug-13 2:45am

Thank you so Much. It's working and thanks a lot

## Solution 1

looks like you are just looking for where the amount paid is less than 12000.

SQL
```SELECT Id, Installment_No, Amount_Paid
FROM Fee
Where (AmountPaid < 12000);```