我有一些像这样的属性:
我只想从那个属性中获取YEAR。为了您的信息,TanggalMasuk意味着DATE。
我有这样的查询:
select DISTINCT YEAR(TanggalMasuk),
(SELECT COUNT(*) AS `Lakilaki` from `kampusmst_orang`
LEFT JOIN `akdmst_mahasiswasarjana` on `kampusmst_orang`.`NIMS1Key` = convert(`akdmst_mahasiswasarjana`.`NIM` using utf8)
WHERE `JenisKelaminID` = 1 AND `mhsMagister`.YEAR(TanggalMasuk)=`akdmst_mahasiswasarjana`.YEAR(TanggalMasuk)) AS `Lakilaki`,
(SELECT COUNT(*) AS `Perempuan` from `kampusmst_orang`
LEFT JOIN `akdmst_mahasiswasarjana` on `kampusmst_orang`.`NIMS1Key` = convert(`akdmst_mahasiswasarjana`.`NIM` using utf8)
WHERE `JenisKelaminID` = 2 AND `mhsMagister`.YEAR(TanggalMasuk)=`akdmst_mahasiswasarjana`.YEAR(TanggalMasuk)) AS `Perempuan`,
(SELECT COUNT(*) AS `Lainlain` from `kampusmst_orang`
LEFT JOIN `akdmst_mahasiswasarjana` on `kampusmst_orang`.`NIMS1Key` = convert(`akdmst_mahasiswasarjana`.`NIM` using utf8)
WHERE `JenisKelaminID` = 5 AND `mhsMagister`.YEAR(TanggalMasuk)=`akdmst_mahasiswasarjana`.YEAR(TanggalMasuk)) AS `Lainlain`,
(SELECT COUNT(*) AS `Total` from `kampusmst_orang`
LEFT JOIN `akdmst_mahasiswasarjana` on `kampusmst_orang`.`NIMS1Key` = convert(`akdmst_mahasiswasarjana`.`NIM` using utf8)
WHERE `mhsMagister`.YEAR(TanggalMasuk)=`akdmst_mahasiswasarjana`.YEAR(TanggalMasuk)) AS `Total`
from `akdmst_mahasiswasarjana` AS `mhsMagister`
ORDER BY `mhsMagister`.YEAR(TanggalMasuk)
但结果是错误的。这是消息错误:
我该怎么做才能解决这个问题?提前完成了