DELIMITER $$
ALTER ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v_t_buku_bank` AS
SELECT
`b`.`id` AS `id`,
`b`.`no_bku` AS `no_bku`,
`b`.`tanggal` AS `tanggal`,
`b`.`tanggal_bayar` AS `tanggal_bayar`,
`b`.`id_transaksi_bank` AS `id_transaksi_bank`,
`b`.`no_bukti` AS `no_bukti`,
`b`.`jumlah` AS `jumlah`,
`b`.`id_akun_pendapatan` AS `id_akun_pendapatan`,
`ap`.`kode` AS `pendapatan_kode`,
`m`.`jenis` AS `jenis`,
`m`.`nama` AS `transaksi`,
`ap`.`nama` AS `pendapatan`,
IF((`m`.`jenis` = 'm'),`b`.`jumlah`,0) AS `masuk`,
IF((`m`.`jenis` = 'k'),`b`.`jumlah`,0) AS `keluar`
FROM ((`t_buku_bank` `b`
JOIN `t_master_transaksi_bank` `m`
ON ((`m`.`id` = `b`.`id_transaksi_bank`)))
LEFT JOIN `akun_pendapatan` `ap`
ON ((`ap`.`id` = `b`.`id_akun_pendapatan`)))$$
IF((`b`.`id_transaksi_bank` = '11'),`b`.`jumlah`,0) AS `m11`,
IF((`b`.`id_transaksi_bank` = '12'),`b`.`jumlah`,0) AS `m12`,
IF((`b`.`id_transaksi_bank` = '21'),`b`.`jumlah`,0) AS `k21`,
IF((`b`.`id_transaksi_bank` = '22'),`b`.`jumlah`,0) AS `k22`,
IF((`b`.`id_transaksi_bank` = '23'),`b`.`jumlah`,0) AS `k23`
FROM (`t_buku_bank` `b`
JOIN `t_master_transaksi_bank` `tb`
ON ((`tb`.`id` = `b`.`id_transaksi_bank`)))$$
DELIMITER ;
我收到了错误代码:1064
您的SQL语法有错误;检查手册 对应于您的MySQL服务器版本,以便使用正确的语法 靠近'IF({
b
。id_transaksi_bank
='11'),b
。jumlah
,0)ASm11
,
IF({b
。`id_tran'在第1行
请帮助我,我是mysql的新手
答案 0 :(得分:0)
您有两个$$
会破坏您的查询:
ON ((`ap`.`id` = `b`.`id_akun_pendapatan`)))$$
和
ON ((`tb`.`id` = `b`.`id_transaksi_bank`)))$$
删除它们然后重试