Task: there are 500 borrowers, some of them have several loans.
In the mysql table there are data 1116 loans of these 500 borrowers. In the g_id column there are values: from 1 to 500, for example, if the value of number 1 has 4 credits, among 1116 records the value of number 1 will be 4 times.
1-select : with delinquency condition, the sample showed 111 (91 with distict),
those. 91 borrowers out of 500 are in the bad group.
2-select : where not the conditions of the 1st select, the sample showed 468 with dist.,
Now it is necessary to make a selection based on the 2nd select, which will be able to show those unique values from the same column that do not have these 91 values (from the 1st select).
as a result: the sample should show 500-91 = 409 values of a good credit.
Tried like this: ("select g_id form(select-2) where not (select-1)") . does not work.
1st select:
$a=$bank->query("SELECT distinct G_id FROM `prosroc` WHERE (((amount<=1001 and currency='USD') or (amount<=8500 and currency='TJS') and credit_term<=12) and num_overdue>10) or ((((amount<=1001 and currency='USD') or (amount<=8500 and currency='TJS')) and (credit_term between 13 and 24)) and num_overdue>15) or ((((amount<=1001 and currency='USD') or (amount<=8500 and currency='TJS')) and credit_term between 25 and 36) and num_overdue>18) or ((((amount between 1001 and 3001) and currency='USD') or ((amount between 8500 and 24000) and currency='TJS')) and credit_term<=12 and num_overdue>10) or (((((amount between 1001 and 3001) and currency='USD') or ((amount between 8500 and 24000) and currency='TJS')) and (credit_term between 13 and 24)) and num_overdue>15) or (((((amount between 1001 and 3001) and currency='USD') or ((amount between 8500 and 24000) and currency='TJS')) and (credit_term between 25 and 36)) and num_overdue>18) or ((((amount>3001 and currency='USD') or (amount>24000 and currency='TJS')) and (credit_term<=12)) and num_overdue>10) or ((((amount>3001 and currency='USD') or (amount>24000 and currency='TJS')) and (credit_term between 13 and 24)) and num_overdue>15) or ((((amount>3001 and currency='USD') or (amount>24000 and currency='TJS')) and (credit_term between 25 and 36)) and num_overdue>18)"); $a_2=$a->num_rows; echo "Количество плохих кредитов : ".$a_2.";
select ...you can see? - E_p