---
# System prepended metadata

title: 體育 - 撈注單

---

# 運營 - 撈遊戲注單

#### SQL 樣板

```sql
-- 開始日期和結束日期
SET @start_date = '2024-01-01';
SET @end_date = '2024-01-22';

-- 輸入要撈取注單的遊戲縮寫 + _record
SET @db_name = 'fb_record';


SET @sql = NULL;


SELECT GROUP_CONCAT(
    DISTINCT CONCAT('SELECT * FROM ', @db_name, '.', table_name)
    SEPARATOR ' UNION ALL '
) INTO @sql
FROM information_schema.tables
WHERE table_schema = @db_name
  AND table_name LIKE 'gameRecord%'
  AND SUBSTRING(table_name, 11) BETWEEN DATE_FORMAT(@start_date, '%Y%m%d') AND DATE_FORMAT(@end_date, '%Y%m%d');


PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;

```
