mySQL如果存在返回值,则否则请零(或任何归因)
我有一个带有一个简单表的MySQL DB ...
ID(键),MessageID,时间
我需要一个查询,如果我传递MessageID,如果它存在,它将给我退还消息ID。否则,任何其他值,例如0。
我尝试以各种公式为“存在”,但它要么获得0或1。 如果存在,我需要MessageID进行进一步处理。
谢谢大家。 DD
I have a MySQL DB with one simple table...
id(key), messageid, time
I need a query that if i pass the messageid it will give me back the message id if it exists. otherwise any other value like 0.
I have tried "EXISTS" in various formulas but it either get 0 or 1.
If it exists, I need the messageid for further processing.
Thank you all.
DD
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
听起来就像您只需要:
It sounds like you simply need: