Sql Server CE 我可以从表中删除 TOP 或仅 1 条记录与我的查询匹配吗 [英] Sql Server CE can I delete TOP or only 1 record from table that matches my query
本文介绍了Sql Server CE 我可以从表中删除 TOP 或仅 1 条记录与我的查询匹配吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
select Top(1)* from TableName Where columnName=value
select Top(1)* from TableName Where columnName=value
只选择第一行就好了.但是,如果我将选择更改为删除,我会收到一个错误,并且无法弄清楚如何编写查询以仅从数据库中删除与我的查询匹配的 1 条记录.
selects only the first row just fine. However if I change the select to a delete I get an error and can't figure out how to write a query to delete only 1 record that matches my query from the db.
我想知道是否有人比我更聪明,是否或如何在 SQL CE 中完成此操作.
I'm wondering if anybody out there smarter than I knows if or how this can be done in SQL CE.
推荐答案
您是否尝试过这样的事情?
Did you try something like this?
DELETE TableName where IdColumn In ( select Top(1) IdColumn from TableName Where columnName=valuev)
这篇关于Sql Server CE 我可以从表中删除 TOP 或仅 1 条记录与我的查询匹配吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文