我数据库中的一个表是这样的
我知道subject1~~到subject6的一个值,我想查出我知道的这个值在那行,也就是id是多少。
比如说,我知道的是14,我想查出3来。该怎么做呢,各位大神帮帮忙。

解决方案 »

  1.   

    select id from table where subject1 = 14 or subject2 = 14 or subject3 = 14 or subject4 = 14 or subject5 = 14 or subject6 = 14
      

  2.   

    C# 遍历 List<实体>   泛化column(实体的反射) 处理 
      

  3.   

    select id from table where (subject1 = 14 or subject2 = 14 or subject3 = 14 or subject4 = 14 or subject5 = 14 or subject6 = 14)
      

  4.   

    select id from 你的表名 where subject3=14
      

  5.   

    select id from table where (subject1 = 14 or subject2 = 14 or subject3 = 14 or subject4 = 14 or subject5 = 14 or subject6 = 14)