クエリに非常に具体的なインクルードがCAST/CASE
必要ですが、これを行う方法がよくわかりません。これが私のSQLLINEです:
SELECT * FROM table WHERE (
type = 'aaa' OR
type = 'bbb' OR
type = 'ccc' OR
type = 'ddd')
AND (points NOT LIKE '-%')
ORDER BY id DESC LIMIT 10
私が実行しようとしているのはそれです:
if : 'type'_remove EXISTS and 'type'->data == 'type'_remove->data
then : Don't select the 'type' row.
例、およびクエリで選択するかどうか:
id type data points
----------------------------------
1 aaa 1 1 don't select : aaa_remove exists and data are the same
2 bbb 1 3 select : bbb_remove exists BUT data aren't the same
3 ddd 1 -1 don't select : points IS LIKE '-%'
4 aaa_remove 1 -1
5 ddd 1 -3 don't select : points IS LIKE '-%'
6 bbb_remove 2 -1
7 ccc 1 1 select : ccc_remove doesn't exists with the same data