一、 查询时排除重复 : distinct

想用查询语句查询某字段的不重复的值,需要使用 distinct 关键字

select distinct type from user;

 

二、 WHERE ... IN 和 子查询结合

把子查询某字段的结果作为组合在 WHERE ... IN 中做条件使用:

update  user_profile set type = 2 WHERE uid  IN ( select uid from user where status = 1 );

 

 

相关文章:

  • 2021-04-16
  • 2022-12-23
  • 2021-06-04
  • 2021-09-30
  • 2021-11-27
  • 2021-08-17
  • 2022-01-13
猜你喜欢
  • 2021-04-28
  • 2021-09-25
  • 2021-06-26
  • 2022-12-23
  • 2021-07-01
  • 2022-01-15
相关资源
相似解决方案