How can I generate the SQL query using SQL::Abstract?
问题 How do I generate the WHERE clause for this query using SQL::Abstract: SELECT COUNT(*) FROM table WHERE id = 111 AND NOT FIND_IN_SET(type, '1,2,3,4') AND status = 'pending'; What's the proper way to include conditions like WHERE FIND_IN_SET(type, '1,2,3,4') ? 回答1: See the not_bool unary operator option: use SQL::Abstract; my $sql = SQL::Abstract->new; my $where = { id => 111, status => 'pending', -not_bool => "FIND_IN_SET(type, '1,2,3,4')", }; my ($query, @bind) = $sql->select( 'table',