how can select 3 records of foreign key with join in sql
jalal mobini. The question was asked: Apr 15, 2020. 08:20
2 answers
I'm sorry for my poor English . I have a table for project registration : like
Type of service | Total Amount | prepayment | last payment | Cost of tolls web design | 1000 | 1 (F-key) | 2 (F-key) | 3 (F-key)
The second table for the status of payment and amount
id | amount | Payment status | Description 1 | 400 | yes | for prepayment 2 | 600 | no | for last payment 3 | 0 | no | for Cost of tolls
Now my question is : How can I join two tables And pull out all THAT three columns ?
I've pulled out the prepayment column with this code
SELECT mzmx_request.service, mzmx_request.amount, (mzmx_payment.payment) as prepayment, (mzmx_payment.status) as prepayment_status FROM mzmx_request JOIN mzmx_payment ON mzmx_request.prepayment = mzmx_payment.id
How do I add two more columns?
JOIN mzmx_payment ON mzmx_request.payment = mzmx_payment.id JOIN mzmx_payment ON mzmx_request.pay_more = mzmx_payment.id