---
# System prepended metadata

title: '體育運營：融合版撈取注單 '

---

# 體育運營：融合版撈取注單

```sql!
-- 设置开始日期和结束日期
--     開始時間為大於等於 （ >= )
--     結束時間為小於但不等於 (<)
SET @start_date = '2024-04-01 00:00:00';
SET @end_date = '2024-04-19 00:00:00';

-- 设置要查询的游戏表名
SET @table_name = 'KYSport2_gameRecord';


-- 创建查询SQL
SET @sql = CONCAT('
  SELECT g.*, gi.GameName 
  FROM detail_record.', @table_name, ' g 
  LEFT JOIN KYDB_NEW.GameInfo gi ON g.KindID = gi.GameID 
  WHERE 1 = 1 
  AND g.GameEndTime >= ''', @start_date, ''' 
  AND g.GameEndTime <  ''', @end_date, ''' 
');

-- 预处理、执行和释放语句
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;


```