Member Avatar

I'm making money lending system. On that I use mysql database. I want to find customer's who skipped their daily instalment. I try this code. But It has error.
Prveious code:

 SELECT l.loan_id, l.custormer_id,custormer_name FROM loan l 
 JOIN income i ON l.loan_id = l.loan_id
 WHERE l.loan_id NOT IN (SELECT loan_id FROM income WHERE date_received = curdate()) and loan_status = 'not finish'

I have CUSTOMER,LOAN,INCOME tables. On customer table it holds all deatails of custormers. On loan table it holds all details of loans. On income table there are columns which named receipt_no, customer_id,loan_id,date_received and amount.
Above PREVIOUS CODE show all records not in today date (using 'CURDATE').
Think like this,
On income table, it had 100 records on 2016-01-01
WHEN I run PREVIOUS CODE on 2016-01-02 ; it show all the records on 2016-01-01. But I want isn't this.
At that time problem that results viewing all records of income instead I only want to get one name per one time.
Any Idea to resolve this ????

Re: Help With SQL advance SELECT query 80 80

So you get duplicate records? You might want to have a look at DISTINCT

Re: Help With SQL advance SELECT query 80 80
Member Avatar

thank you bro, I got answer :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.