有两个表:history_oper
date_oper | user_phone | sms
01.06.20 | 7999999999 | txtxtx 1234 txtxt
和 err_opers
dat | tel | sum
01.06.20 | 7999999999 | 1234
需要从history_oper、表err_opers中选择错误操作的行。困难在于,在 sms 字段的第一个表格中,有一个包含金额 (1234) 的文本,而在第二个表格中,只有这个金额没有显示。这样做了
SELECT * FROM `history_oper` WHERE
`date_oper` IN (SELECT dat FROM err_opers)
AND `user_phone` IN (SELECT tel FROM err_opers)
AND `sms` LIKE IN(SELECT sum FROM err_opers)
第三个条件怎么写正确?
您的请求不正确,它会给出额外的记录。试试看