我在mysql中有一个表,其名称如下
我有两件事要处理
1-停用所有未使用的书籍
isActive = 1 - Active
isActive = 0 - Inactive
is_inuse = 1 - in use
is_inuse = 0 - not in use
I have the query as such
. . .
update books
set is_active=0
where book_name in (select (book_name)
from books
group by book_name
having count(1) >1
) and
is_inuse != 1;
2-重命名除最小图书id外的所有重复图书,在图书名称前附加图书id。很难对这个案子进行调查。
1条答案
按热度按时间rhfm7lfc1#
您应该能够使用下面的sql获取重复图书名称的列表