/*SELECT * FROM mydb_bets.lsports_leagues where id in (
SELECT id FROM mydb_betgo.lsports_leagues);*/

/*SELECT count(*) FROM mydb_betgo.lsports_leagues where is_use = 1;
SELECT count(*) FROM mydb_bets.lsports_leagues where is_use = 1;*/

/*SELECT * FROM mydb_betgo.lsports_leagues where id not in (
SELECT id FROM mydb_bets.lsports_leagues);*/

-- 57344

-- 없는 리그 데이터 테이블 생성
/*
CREATE TABLE `tm_bets_add_lsports_leagues` (
  `id` int(11) NOT NULL DEFAULT 0,
  `bet_type` int(11) NOT NULL,
  `name` varchar(45) DEFAULT NULL,
  `display_name` varchar(45) DEFAULT NULL COMMENT '사용자에게 보여지는 이름 ',
  `location_id` int(11) DEFAULT NULL,
  `sport_id` int(11) DEFAULT NULL,
  `season` varchar(45) DEFAULT NULL,
  `lang` varchar(4) DEFAULT NULL,
  `create_dt` datetime DEFAULT current_timestamp(),
  `update_dt` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `delete_dt` datetime DEFAULT NULL,
  `is_use` tinyint(4) DEFAULT 2 COMMENT '리그 사용 여부 0 : 미사용 1 : 사용 2 : 대기 ',
  `deduction_refund_rate` decimal(5,2) DEFAULT 0.00,
  `is_margin_refund` int(11) DEFAULT 0,
  `dividend_rank` int(10) unsigned NOT NULL DEFAULT 1 COMMENT '배당금액 등급',
  `my_league` int(11) DEFAULT 0,
  `quarter_time` int(11) DEFAULT NULL,
  `image_path` varchar(200) DEFAULT '',
  `input_refund_rate` decimal(5,2) DEFAULT 0.00,
  PRIMARY KEY (`bet_type`,`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
*/

--  create table if not exists tm_add_lsports_leagues
/*insert into tm_bets_add_lsports_leagues
SELECT * FROM mydb_betgo.lsports_leagues where bet_type = 2 and id not in (
SELECT id FROM mydb_bets.lsports_leagues where bet_type = 2);


insert into mydb_kwin.lsports_leagues
SELECT * FROM mydb_kwin.tm_add_lsports_leagues;
*/

/*SELECT * FROM mydb_bets.lsports_leagues where id in (
SELECT id FROM mydb_betgo.lsports_leagues where is_use = 1 and bet_type = 1) and bet_type = 1 and is_use <> 1;

SELECT * FROM mydb_bets.lsports_leagues where id in (
SELECT id FROM mydb_betgo.lsports_leagues where is_use = 1 and bet_type = 2) and bet_type = 2 and is_use <> 1;

SELECT * FROM mydb_bets.lsports_leagues where id in (
SELECT id FROM mydb_betgo.lsports_leagues where is_use = 0 and bet_type = 1) and bet_type = 1 and is_use <> 0;

SELECT * FROM mydb_bets.lsports_leagues where id in (
SELECT id FROM mydb_betgo.lsports_leagues where is_use = 0 and bet_type = 2) and bet_type = 2 and is_use <> 0;*/