| 注册
请输入搜索内容

热门搜索

Java Linux MySQL PHP JavaScript Hibernate jQuery Nginx

如何在PostgreSql数据中SELECT的时候A字段如果内容空就返回B字段的内容?

0
PostgreSQL 数据库 25482 次浏览

   content表有一个body字段和clean_body字段,单独获取body很容易用,select body from content就可以了,最近业务需要扩展了一个clean_body字段,用来存放body清洗后的数据。现在业务逻辑就是在clean_body中内容为空时,自动到body中去获取数据。

   如果直接将两个字段的内容都读出(select body,clean_body from content)然后在代码中自己判断也是可以的,这样做总觉得怪怪的,如果在数据库一层就可以做到的话是最完美的!

17个答案

0

http://cdkfpgs.wikidot.com
http://xakfpgs.wikidot.com
http://kmkfpgs.wikidot.com
http://dgkfpgs.wikidot.com
http://shkfpgs.wikidot.com
http://tjkfpgs.wikidot.com
http://jnkfpgs.wikidot.com
http://zqkfpgs.wikidot.com
http://whkfpgs.wikidot.com
http://gykfpgs.wikidot.com
http://zhkfpgs.wikidot.com
http://hfkfpgs.wikidot.com
http://yzkfpgs.wikidot.com
http://mmkfpgs.wikidot.com
http://lygkfpgs.wikidot.com

http://cdkfpgs.wikidot.com/start
http://xakfpgs.wikidot.com/start
http://kmkfpgs.wikidot.com/start
http://dgkfpgs.wikidot.com/start
http://shkfpgs.wikidot.com/start

0

兰州开发票 https://www.flipsnack.com/028kfp/-.html
甘肃开发票 https://www.flipsnack.com/028kfp/--fzuj0hnt4.html
平凉开发票 https://www.flipsnack.com/028kfp/--ftni2p3ko.html

0

https://vk.com/public193352058
https://vk.com/public193352101
https://vk.com/public193352111
https://vk.com/public193352122
https://vk.com/public193352128
https://vk.com/public193352135
https://vk.com/public193352160
https://vk.com/public193352599
https://vk.com/public193352617
https://vk.com/public193352624
https://vk.com/public193352639
https://vk.com/public193352647

0

Thanks for Nice and Informative Post. This article is really contains lot more information about This Topic.Thanks for Nice and Informative Post. This article is really contains lot more information about This Topic.

gmail sign up

0

浏览器调试网页chrome://inspect/#devic 

0

Welcome back to one of the world’s most intense mazes. Will you reach each one of the checkpoints in this epic action game? You’ll need to watch out for everything from moving platforms to bottomless pits! super smash flash 2

0

This is perfect but I chose this platform to ask one question about how do you use an IF function for a blank cell? Cheap Coursework Help UK

0

破解版的 好不容易找到 低调分享阿
贴吧都在求
下载地址:http s:/ /bit.l y/360Pu 23我想要推荐软体
 

0

Students usually look for University term paper writing service when they cannot tackle their assigned project on their own. They prefer taking help with University case study writing service for subjects that are really tough and cannot be managed by them. That University homework writing service can be in the form of their elders or classmates or previous project samples. But there is certainly a huge difference between a professional GlobalResearchService and an amateur, a sample paper and a fair project submission.

0

我对你在文章中提供的信息印象非常深刻。 我必须说你的整个故事都非常不知所措。 现在在网上获得如此高质量的信息并不容易。 我期待在这里待很长时间。

192.168.l.l

0

I felt very happy while reading this site. This was a really very informative site for me. I really liked it. This was really a cordial post. Thanks a lot!  xvideos xnxx xxx

0

Would like to remove hover tab, but retain color themesSo I cant seem to figure out how to remove just the hover portion of this. I'd like to keep the colors and whatnot, but it's annoying to have to hover over the rules to see them. Kinda looks like we don't even have any

 

0

This article has suggested to me many new ideas. I will embark on doing it. Hope you can continue to contribute your talents in this area. Thank you. placar uol

0

I felt very happy while reading this site. This was a really very informative site for me. I really liked it. This was really a cordial post. Thanks a lot!
fireboy and watergirl
 

0

http://uqseo.com/so/%E4%BC%AA%E5%9F%BA%E7%AB%99%E4%BF%A1%E6%81%AF%E7%BE%A4%E5%8F%91%E5%99%A8%E5%A4%9A%E5%B0%91%E9%92%B1%28152x0203x2162%E7%94%B5%E8%96%87%E5%90%8C%E5%8F%B7%29

0

阿是的对方水电费

1

你用下面这个SQL语句试试看:

SELECT (CASE WHEN (clean_body IS NULL OR clean_body = '') THEN body ELSE clean_body END) as body FROM content;