我写的是
select count(*) as recordcount from part_words where words_unit = 'unit2' and words_unit='unit1'
发现数据库中的返回结果是0
请问这条SQL语句应该如何写呢?
...全文
2763打赏收藏
sql语句同一字段多条件查询的问题
我的数据库库中有一个表名称是 part_words 表中有一个字段是 words_unit 在这个数据库中包含了很多数据,数据条中数据库在words_unit这个字段有unit1-unit10 这10个单元的内容 我现在想查询出Unit1和Unit2和Unit3 这3个单元的所有数据内容的总数 请问sql语句应该如何查询 我写的是 select count(*) as recordcount from part_words where words_unit = 'unit2' and words
select count(*) as recordcount from part_words where words_unit = 'unit2' Or words_unit='unit1'
或者:
select count(*) as recordcount from part_words where words_unit like 'unit[123]'