SQL Quries遇到问题。 [英] SQL Quries getting problem .

查看:93
本文介绍了SQL Quries遇到问题。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HEllo团队,



我的查询如下:

第一次,当我点击GetCount按钮时,我我得到的记录如下:

HEllo Team,

I have the query as follows:
At very first time ,when i click on GetCount Button, i am getting the records as follows:

select * from Customerloandata with (nolock) where createdby = 2  AND createdon >='2014-01-01 00:00:00'  and createdon<='2014-04-29 00:00:00'
 and batchid in (1)  and isnull(deleted,0) = 0 and qctoverify = 1 and QCProcessed = 1  and STATE = ''





第二次,当我更新记录时,我的查询如下:





At the second time, When i am updating the Record , I have query as follows:

UPDATE [CUSTOMERLOANDATA] WITH (ROWLOCK)   SET [QCUSERID] = 13  WHERE ID IN
 (select top(1) ID as count from Customerloandata with (nolock) where QCTOVERIFY = 1 and createdby = 2  AND createdon >='2014-01-01 00:00:00'
 and createdon<='2014-04-29 00:00:00' and QCProcessed = 1 and batchid in ( 1)  and isnull(deleted,0) = 0  and STATE = '' )





但是在更新了一条记录后我不想在第一个查询中记录。怎么做。请让我知道。如果您需要任何帮助,请告诉我。



谢谢

Harshal



But after updating the one record i dont want to see that record in the first query.How to do that .Please let me know.if you required any help please let me know.

Thanks
Harshal

推荐答案

嗨团队,



Hi Team,

updateQuery.Append("UPDATE [CUSTOMERLOANDATA] WITH (ROWLOCK)");
                    updateQuery.Append("   SET [QCUSERID] = " + qcallocation.ToQCUserId + " ");
                    updateQuery.Append("       ,QCPROCESSED = 0 ");
                    updateQuery.Append(" WHERE ID IN  (select top(" + qcallocation.AllocationCount + ") ID as count from Customerloandata with (nolock) where QCTOVERIFY = 1 and createdby = " + qcallocation.FromDEOUserId + "  AND createdon >='" + qcallocation.FromDate.Value.ObjectToDBDateTime() + "'  and createdon<='" + qcallocation.ToDate.Value.ObjectToDBDateTime() + "' and QCProcessed = 1 and batchid in ( " + qcallocation.BatchId + ")  and isnull(deleted,0) = 0 " + (qcallocation.State != string.Empty ? " and STATE = '" + qcallocation.State + "'" : string.Empty) + " )");







它适用于我。

非常感谢Kumar Prateek。




Its works for ME .
Thank you so much Kumar Prateek.


这篇关于SQL Quries遇到问题。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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