Mysql
 sql >> Teknologi Basis Data >  >> RDS >> Mysql

php,postgresql,mysql

Coba ini

select  cont.name, cont.total,cp.contractor_id,cp.amount_paid,wt.id
                FROM
                (
                  select  name,id, sum(amount_to_be_paid) as total
                  from contractors group by name,id
                ) cont
                left join
                (
                  select contractor_id,sum(amount_paid) as amount_paid
                  from contractor_payments
                  group by contractor_id
                ) cp

                  on cont.id = cp.contractor_id
                              left join worktypeids as wt on cont.worktypeid_id = wt.id AND wt.project_id=2


  1. Database
  2.   
  3. Mysql
  4.   
  5. Oracle
  6.   
  7. Sqlserver
  8.   
  9. PostgreSQL
  10.   
  11. Access
  12.   
  13. SQLite
  14.   
  15. MariaDB
  1. Masuk ke file melalui PHP atau masuk ke database MySQL - mana yang lebih cepat?

  2. Bisakah magento menggunakan beberapa budak MySQL?

  3. mySQL mengatur varchar tanpa karakter khusus

  4. Jumlah maksimum kolom dalam tabel MySQL

  5. Menjalankan AMP (apache mysql php) di Android