Reputation: 41
I Have two tables,
1st table --> loan , columns --> pos_num , pos_type
2nd table --> payment, columns --> pos_num , pos_type , date
I want to extract pos_num , pos_type values from loan and place in the below query
select count(1) from payment where pos_num = <value extracted from loans> and pos_type = <value extracted from loans> and date = <?>
How can we i join loan table with payment table to get the date where we should have same data in payment table for pos_num , pos_type that we got from loan table
Upvotes: 0
Views: 44
Reputation: 573
You can get the values with JOIN sentence like:
SELECT pos_num , pos_type , date
FROM loans L
JOIN payment P ON L.pos_num = P.pos_num AND L.pos_type = P.pos_type;
I hope to be helpful.
Upvotes: 1