SELECT CASE WHEN @mid = t.PAY_TIME THEN ELSE END SEQ, @mid := t.PAY_TIME, t.AMOUNTS, t.CHARGE_PRICE, t.MONEY, t.PAY_TIME AS CHARGE_TIME, t.PRODUCT_ID, t.PRODUCT_NAME, t.CANRETURNCOUNT, t.ID FROM ( SELECT bmb.ID, bmb.PRODUCT_ID, bmb.PRODUCT_NAME, bmb.…