/*CREATE TABLE `black_list` (
  `account_name` varchar(45) NOT NULL,
  `account_bank_id` varchar(45) NOT NULL,
  `account_bank` varchar(45) NOT NULL,
  `account_number` varchar(45) NOT NULL,
  PRIMARY KEY (`account_name`,`account_number`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='블랙리스트 계정정보';

CREATE TABLE `black_list_call` (
  `call` varchar(45) NOT NULL,
  PRIMARY KEY (`call`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='블랙리스트 폰번호';*/


SELECT idx, id, nick_name, u_business, level, status, m.account_bank, m.account_name, m.account_number
FROM mydb.member as m
JOIN black_list_account as bla on m.account_bank = bla.account_bank and m.account_number = bla.account_number
where u_business = 1 and m.level <> 9 and m.status = 1;

SELECT idx, id, nick_name, u_business, level, status, m.account_bank, m.account_name, m.account_number FROM mydb.member as m
JOIN black_list_call as blc on m.call = blc.call
where u_business = 1 and m.level <> 9 and m.status = 1


/*select * from (SELECT idx, id, nick_name, u_business, level, status, m.account_bank, m.account_name, m.account_number
,(SELECT account_bank from black_list_account as bla where bla.account_bank = m.account_bank and bla.account_number = m.account_number) as bank
,(SELECT `call` from black_list_call as blc where m.call = blc.call) as `call`
FROM mydb_DEV.member as m where u_business = 1 and m.level <> 9) as a
where a.bank is not null;*/


/*explain SELECT idx, id, nick_name, u_business, level, status, account_bank, account_name, account_number FROM mydb_DEV.member
where u_business = 1 and level <> 9 and account_bank in (SELECT account_bank from black_list_account where account_bank)*/