IN操作者如何实现和条件

时间:2015-01-21 11:37:12

标签: mysql

  

IN运算符在IN()中的值之间应用或条件。我想要   在数组中实现和调整值之间的条件。怎么办呢?

SELECT J.ID , J.U_POST_ID,
        J.TITLE,J.CREATION_DATE,J.STATUS,
        R.FIRST_NAME, R.LAST_NAME,R.CLINICAL_CLINIC_NAME,
        J.REQUIREMENT,J.STATE,J.CITY,J.DESCRIPTION,J.CALL_DUR,J.USER_ID
        FROM  
        df_job_meta M LEFT OUTER JOIN df_job_post J ON
        M.JOB_ID = J.ID
        LEFT OUTER JOIN df_register_users R ON 
        R.ID = J.USER_ID
        WHERE
        J.STATUS='ACTIVE'  AND R.OCCUPATION !='student' AND J.STATE IN ('Maharashtra') AND J.CITY IN ('Nagpur') and  M.VALUE IN ('Clinical','Fresher','BDS Intern','Full Time')
  

以上查询选择"新鲜"的值或者"临床"

I want to  select row  associated with both  fresher and Clinical

表格结构如下

META_KEY   |    VALUE

experience |    fresher
num_vacancy|    1
profile    |Clinical

2 个答案:

答案 0 :(得分:0)

您可以使用 IN 子句替换许多 OR 条件。否则只需使用AND。

答案 1 :(得分:0)

我不是百分之百确定它会起作用,但我认为它应该

SELECT * FROM Customers
    WHERE `VALUE` REGEXP 'fresher|Clinical'