313循环check no后修正的sql

SELECT group_concat(submission_id)
FROM (
SELECT submission_id
FROM (
SELECT submission_id
FROM voucher_store_submission
WHERE submission_id IN (7716,7813,7814,7825,7826,7827,7828,7833,7834,7835,7836,7837,7838,7839,7840,7841,7842,7843,7844,7845,7846,7847,7848,7849,7850,7852,7853,7854,7855,7856,7857,7858,7859,7860,7861,7862,7863,7864,7865,7866,7867,7868,7869,7870,7871,7872,7873,7874,7875,7876,7877,7878,7879,7880,7881,7883,7884,7885,7886,7887,7889,7890,7891,7892,7893,7894,7895,7896,7897,7898,7899,7900,7901,7902,7903,7905,7906,7907,7908,7909,7910,7911,7912,7913,7914,7915,7916,7917,7918,7919,7920,7921,7922,7923,7924,7925,7926,7927,7928,7929,7930,7931,7932,7933,7934,7935,7936,7937,7938,7939,7941,7942,7943,7944,7945,7946,7947,7948,7949,7950,7951,7952,7953,7954,7955,7956,7958,7959,7960,7961,7962,7963,7964,7965,7966,7967,7968,7969,7970,7971,7972,7973,7975,7976,7977,7978,7979,7980,7981,7982,7983,7984,7985,7986,7987,7988,7989,7990,7991,7992,7993,7994,7995,7996,7997,7998,7999,8000,8001,8002,8003,8005,8006,8007,8010,8011,8013,8014,8015,8016,8017,8018,8019,8020,8021,8022,8024,8025,8026,8027,8028,8029,8030,8031,8032,8033,8036,8037,8038,8039,8040,8041,8043,8044,8045,8046,8047,8048,8049,8050,8051,8052,8053,8054,8055,8056,8057,8058) UNION ALL
SELECT submission_id
FROM voucher_store_submission
WHERE submission_id IN (7716,7813,7814,7825,7826,7827,7828,7833,7834,7835,7836,7837,7838,7839,7840,7841,7842,7843,7844,7845,7846,7852,7853,7854,7856,7858,7859,7861,7862,7863,7864,7865,7867,7869,7870,7871,7872,7873,7874,7875,7876,7877,7878,7879,7880,7881,7883,7885,7886,7887,7889,7890,7891,7892,7893,7894,7895,7896,7897,7898,7899,7900,7901,7902,7903,7905,7907,7908,7909,7910,7911,7912,7913,7914,7916,7917,7918,7919,7920,7923,7924,7925,7926,7928,7929,7930,7931,7932,7933,7935,7937,7938,7949,7950,7951,7952,7953,7954,7955,7960,7961,7962,7963,7964,7970,7972,7973,7976,7978,7980,7982,7983,7985,7986,7987,7988,7989,7991,7993,7995,7996,8000,8002,8005,8006,8007,8010,8016,8017,8024,8028,8029,8033,8036,8038,8045,8048,8050,8051,8052,8054,8057,8058)
)x
GROUP BY submission_id
HAVING COUNT(submission_id) = 1
)x

UPDATE 313_reimburse_import_201409_to_201410 a, 
voucher_store_submission b, 
voucher_purchase_requisition c, 
voucher_reimburse d 
SET c.reimburse_id = d.reimburse_id
WHERE a.submission_id IN (7847,7848,7849,7850,7855,7857,7860,7866,7868,7884,7906,7915,7921,7922,7927,7934,7936,7939,7941,7942,7943,7944,7945,7946,7947,7948,7956,7958,7959,7965,7966,7967,7968,7969,7971,7975,7977,7979,7981,7984,7990,7992,7994,7997,7998,7999,8001,8003,8011,8013,8014,8015,8018,8019,8020,8021,8022,8025,8026,8027,8030,8031,8032,8037,8039,8040,8041,8043,8044,8046,8047,8049,8053,8055,8056) AND a.submission_id = b.submission_id AND b.requisition_id = c.requisition_id AND a.cheque_no = d.cheque_no AND a.cheque_date = d.cheque_date