doushuangdui5419 2015-11-25 05:45
浏览 13

Mysql收集In条件的数据

I am developing job portal web application..

Employees are registering with their qualifications.

After employees are registered successfully,

job adding with qualification on two conditions.

ie, AND , OR case.

Suppose a job having qualification with two AND Conditions like.

Engineering | Btech | Mechanical Engineering | regular | 80 % 
Diploma | CAD | Computer Applications | Distance | 70%

Engineering | Btech | Mechanical Engineering | regular | 80 % 
Diploma |  |   |  | 70%

After entering job qualifications I am collecting that as an array like.

   $a = ["27","26"]; // dummy data
   $b = ["62"]; // dummy data
   $c = ["59"]; // dummy data

I want to collect EMPLOYEE ID data from my employee qualifications table that matching the above condition.

enter image description here

I tried the Where In query like below.

SELECT * FROM `otc_employee_qualifications` 
WHERE `emp_qualifctn_type` IN ('26','27')
AND `qualification_value` IN ('59','32')
AND `emp_qualifctn_branch` IN ('156')
AND `emp_qualifctn_stream` IN ('2')
AND `qualification_mark` >= 27
GROUP BY `employee_id` 
  • 写回答

4条回答 默认 最新

  • dqd22496 2015-11-25 05:48
    关注

    Try to use AND instead of where to join two conditions.

    SELECT * FROM `otc_employee_qualifications` 
    WHERE `emp_qualifctn_type` IN ('26','27')
    AND `qualification_value` IN ('59','32')
    AND `emp_qualifctn_branch` IN ('156')
    AND `emp_qualifctn_stream` IN ('2')
    AND `qualification_mark` >= 27
    GROUP BY `employee_id` 
    
    评论

报告相同问题?

悬赏问题

  • ¥15 高缺失率数据如何选择填充方式
  • ¥50 potsgresql15备份问题
  • ¥15 Mac系统vs code使用phpstudy如何配置debug来调试php
  • ¥15 目前主流的音乐软件,像网易云音乐,QQ音乐他们的前端和后台部分是用的什么技术实现的?求解!
  • ¥60 pb数据库修改与连接
  • ¥15 spss统计中二分类变量和有序变量的相关性分析可以用kendall相关分析吗?
  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!