要从sql表中查找计数..请帮助.. [英] To find count from sql table.. Please Help..

查看:142
本文介绍了要从sql表中查找计数..请帮助..的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

id  candid  jobid    status      date
1    11      11j    Introduced   20/04/2014
2    11      11j    Interviewed  22/04/2014 
3    12      11j    Introduced   22/04/2014
4    13      11j    Introduced   22/04/2014
5    12      11j    Interviewd   24/04/2014
6    12      11j    Rejected     24/04/2014



我只想统计未接受采访的介绍候选人.
即,在上表中,我有3个介绍人候选人,但是面试了2个候选人,这意味着我只需要一个候选人候选人的候选人身份为坦率= 13

我需要sql查询来只统计未面试,被拒绝的介绍候选人..

请任何人帮助我...
我想答复..
请..


我有这样的桌子:



i want to count introduced candidates only which r not interviewd..
i.e. In above table i have 3 introduced candidates, but 2 of them are interviewd that means i need only one introduces candidate having candid = 13

I need the sql query to count only introduce candidates which are not interviewd, rejected..

Please anybody help me with this...
I am wating for reply..
Please..


I am Having table like this:

id  candid  candname        status      date       time     location    jobcode
1   12      hhhhhhhhhh      Introduce   2014-05-21 14:0     NewYork     10JN 
3   12      hhh             Reject      2014-05-21 15:0 AM  London      10JN
4   12      hhhhhhhhhh      Interview   2014-05-21 15:0 PM  Chicago     10JN
5   11      Pinky Bare      Introduce   2014-05-21 65:6     India       10JN 
6   11      Pinky Bare      Interview   2014-05-21  4:56 AM             10JN
7   13      chetan Tae      Introduce   2014-05-21  4:54 AM Nagpur      faOl
8   13      chetan Tae      Interview   2014-05-21  3:45    Pune        faOl
9   14      manisha mane    Introduce   2014-05-21  3:33 PM Pune        faOl
10  18      ranju gondane   Introduce   2014-05-28  3:44    Nagpur      AQW-06
12  18      ranju gondane   Interview   2014-05-28  5:45    45454       AQW-06
13  18      ranju gondane   Reject      2014-05-28 43:43    rsds        AQW-06
14  19      vandanna rai    Introduce   2014-05-28  7:7     yyyr        AQW-06



如果我使用查询



if i use query

SELECT COUNT(*) FROM [tablename] WHERE (jobcode='AQW-06') AND ([status] <> 'Interview' AND [status] <> 'Reject' AND [status] <> 'ON-Hold' AND [status] <> 'Hire')



我得到了2个介绍候选人的信息.

如果候选人在介绍之后接受了面试,则不会算作介绍..



I get count 2 for introduce candidates..

if the candidate is interviewd after introduce, it will not counted as Introduce..

推荐答案

Try
Try
SELECT COUNT(*) FROM MyTable WHERE status <> 'Interviewed' AND status <> 'Rejected'


select COUNT(*) FROM tableName where Status = 'What ever status you want'

--or

select COUNT(*) FROM tableName where Status <> 'What ever status you do not want want'


如果您要删除具有采访状态的记录,可以尝试使用此方法

You could try this if you want to remove records with interviewed status

SELECT count(*) FROM table_name AS t1 WHERE t1.status ='introduced' AND NOT EXISTS
(SELECT candid FROM table_name WHERE status= 'interviewed' AND candid = t1.candid)


这篇关于要从sql表中查找计数..请帮助..的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆