MariaDB 查詢特殊條件
有些特殊條件查詢,需要利用到組合式或JOIN方式查詢。例如:我們要查詢該表格內,有符合在其他表格的條件,皆不要列出的資料。此時可以用
select * from this_table where condition not in ( select condition from another_table );
或
select * from this_table except select condition from another_table;
參考資料
https://stackoverflow.com/questions/8768254/select-values-from-a-table-where-exclude-values-in-another-table
https://mariadb.com/kb/en/library/subqueries-and-joins/
select * from this_table where condition not in ( select condition from another_table );
或
select * from this_table except select condition from another_table;
參考資料
https://stackoverflow.com/questions/8768254/select-values-from-a-table-where-exclude-values-in-another-table
https://mariadb.com/kb/en/library/subqueries-and-joins/