我想比较两列不同的表。我有两个表Books_status,它们有book_id和count,它们总共没有书籍,另一个表是Books_course,它有两列book_id和mini,它们给出了最小的no。的书我想比较Books_status和books_course中的mini的数量。
create trigger alarm after update on Books_status for each row
-> begin
-> declare cnt123 integer;
-> declare mini integer;
-> select count into cnt123 from Books_status where book_id=new.book_id;
-> select minimum into mini from Books_course where book_id=new.book_id;
-> if( mini > cnt123 ) then select 'order books' as '';
-> else select 'no issue' as '';
-> end |
它给我的错误
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 9