选择给出不同结果的查询

发布于 2024-10-11 05:05:14 字数 527 浏览 0 评论 0原文

我已经编写了选择以下查询,但令人惊讶的是,查询中的任何错误都给出了不同的结果。请告诉我。询问:

Select count(*) Count from conflux.dbo.SABR_Master M 
        Where M.Email in (
        select top 26 Email from conflux.dbo.SABR_Master L 
        where (L.titleid In (Select titleid From sabr_titlemasters Where IsDisplay=1 And  title like '%Account Executive%' OR title like '%Account Manager%' OR title like '%Accounts Manager%' OR title like '%admin%'  ))
        ) and M.Email NOT IN (select Email from [sample client].dbo.Comm_CompanyData)

I have written the select fallowing query but it is giving different results surprisingly any wrong in the query. pls let me know. Query:

Select count(*) Count from conflux.dbo.SABR_Master M 
        Where M.Email in (
        select top 26 Email from conflux.dbo.SABR_Master L 
        where (L.titleid In (Select titleid From sabr_titlemasters Where IsDisplay=1 And  title like '%Account Executive%' OR title like '%Account Manager%' OR title like '%Accounts Manager%' OR title like '%admin%'  ))
        ) and M.Email NOT IN (select Email from [sample client].dbo.Comm_CompanyData)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

爱的十字路口 2024-10-18 05:05:14

试试这个,

Select  count(*) Count 
from    conflux.dbo.SABR_Master M 
Where   M.Email in (select  top 26 
                            L.Email 
                    from conflux.dbo.SABR_Master L 
                    where (L.titleid In (   Select  titleid 
                                            From    sabr_titlemasters 
                                            Where   IsDisplay=1 And  
                                                    (title like '%Account Executive%' OR 
                                                    title like '%Account Manager%' OR 
                                                    title like '%Accounts Manager%' OR 
                                                    title like '%admin%')))
                    ORDER BY L.Email) and 
        M.Email NOT IN (select  Email 
                        from [sample client].dbo.Comm_CompanyData)

我在您的标题两边添加了括号,例如“OR”和“订购依据”,以保持您的 26 封电子邮件相同。如果未指定 order by,数据库可能会以随机顺序返回它们,这可能会给出不同的结果。

Try this

Select  count(*) Count 
from    conflux.dbo.SABR_Master M 
Where   M.Email in (select  top 26 
                            L.Email 
                    from conflux.dbo.SABR_Master L 
                    where (L.titleid In (   Select  titleid 
                                            From    sabr_titlemasters 
                                            Where   IsDisplay=1 And  
                                                    (title like '%Account Executive%' OR 
                                                    title like '%Account Manager%' OR 
                                                    title like '%Accounts Manager%' OR 
                                                    title like '%admin%')))
                    ORDER BY L.Email) and 
        M.Email NOT IN (select  Email 
                        from [sample client].dbo.Comm_CompanyData)

I have added brackets around your title like OR's and an Order By to keep your 26 emails the same. The database can return them in a random order if order by is not specified, which can give you different results.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文