在vb.net中的命令执行mysql查询期间遇到致命错误

时间:2019-01-28 07:36:20

标签: mysql vb.net

SELECT *
  FROM (SELECT *, @a := @a + 1 serial_number
          FROM (SELECT dated,
                       COALESCE(SUM(custd), 0) custd,
                       COALESCE(SUM(dealerdd), 0) dealerdd,
                       COALESCE(SUM(balance), 0) balance,
                       dealer_id,
                       receipt_no,
                       customer_id,
                       customer_name,
                       file_id,
                       comp_id,
                       dealer_name,
                       comp_name,
                       recno,
                       which
                  FROM (SELECT 0 AS op_bal,
                               SUM(custdep) AS custd,
                               SUM(dealerdepo) AS dealerdd,
                               (SUM(custdep) - SUM(dealerdepo)) AS balance,
                               dealer_id,
                               customer_id,
                               customer_name,
                               receipt_no,
                               file_id,
                               comp_id,
                               dealer_name,
                               comp_name,
                               dated,
                               recno,
                               which
                          FROM (SELECT COALESCE(SUM(a.deposite_amt), 0)
                                          AS custdep,
                                       0 AS dealerdepo,
                                       a.receipt_no,
                                       a.dealer_id,
                                       a.customer_id,
                                       e.customer_name,
                                       a.file_id,
                                       a.comp_id,
                                       c.Dealer_Name,
                                       d.COMP_NAME,
                                       a.Deposite_date AS dated,
                                       0 AS recno,
                                       1 AS which
                                  FROM customer_deposite_detail a
                                       INNER JOIN dealer_master c
                                          ON a.dealer_id = c.Dealer_id
                                       INNER JOIN comp d
                                          ON a.comp_id = d.comp_id
                                       INNER JOIN customer_master e
                                          ON a.Customer_id = e.Customer_id
                                 WHERE     a.deposite_date BETWEEN '2018-04-01'
                                                               AND '2019-01-28'
                                       AND a.dealer_id = '  8    '
                                       AND a.comp_id = '  15    '
                                GROUP BY a.dealer_id,
                                         c.Dealer_Name,
                                         a.comp_id,
                                         a.Deposite_date,
                                         a.customer_id,
                                         a.receipt_no,
                                         a.file_id,
                                         e.Customer_Name
                                UNION ALL
                                SELECT 0 AS custdep,
                                       COALESCE(SUM(a.deposite_amount), 0)
                                          AS dealerdepo,
                                       0 AS receipt_no,
                                       a.dealer_id,
                                       0 AS customer_id,
                                       '---' AS customer_name,
                                       0 AS file_id,
                                       a.comp_id,
                                       c.Dealer_Name,
                                       d.COMP_NAME,
                                       a.Deposite_date AS dated,
                                       CONCAT(a.from_rec_NO,
                                              '-',
                                              a.to_rec_no)
                                          AS recno,
                                       2 AS which
                                  FROM dealer_deposite_detail a
                                       INNER JOIN dealer_master c
                                          ON a.dealer_id = c.Dealer_id
                                       INNER JOIN comp d
                                          ON a.comp_id = d.comp_id
                                 WHERE     a.deposite_date BETWEEN '2018-04-01'
                                                               AND '2019-01-28'
                                       AND a.dealer_id = '  8    '
                                       AND a.comp_id = '  15    '
                                GROUP BY a.dealer_id,
                                         c.Dealer_Name,
                                         a.comp_id,
                                         a.deposite_Date,
                                         a.from_rec_NO,
                                         a.to_rec_no) AS balance1
                        GROUP BY dealer_id,
                                 comp_id,
                                 dealer_name,
                                 customer_name,
                                 comp_name,
                                 dated,
                                 recno,
                                 customer_id,
                                 receipt_no,
                                 file_id,
                                 which) AS tt
                GROUP BY dealer_id,
                         comp_id,
                         dealer_name,
                         customer_name,
                         comp_name,
                         dated,
                         recno,
                         customer_id,
                         receipt_no,
                         file_id,
                         which
                ORDER BY dated ASC, receipt_no ASC) AS ty,
               (SELECT @a := 0) AS a) AS tXN
ORDER BY CASE WHEN receipt_no = 0 THEN serial_number ELSE receipt_no END ASC

在mysql中执行查询 但是在vb.net中会给出命令执行期间遇到的atal错误

0 个答案:

没有答案