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

0
PostgreSQL 数据库 34177 次浏览

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

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

请尽量让自己的答案能够对别人有帮助

16个答案

默认排序 按投票排序
0

คุณติดขัดปัญหาเรื่องะเงินอยู่หรือไม่ ปัญหาจะหมดไปหากคุณได้รู้จักเล่นเกมออนไลน์ได้เงินจริง เป็น เกมสล็อต

สมัครง่าย เพียงไม่กี่ขั้นตอนเท่านั้น เกมสล็อต ก็เล่นง่านแสนง่าย สนใจติดต่อสอบถามเบื้องต้นได้ที่ Slotxo

หรือสามารถทดลองเล่นเกมก่อนได้ที่  ยูสทดลองslotxo 

0

I read your content. But still do not understand OK, slotxo do we have to move? Is there any content to read more? In order to understand more Anyone know? Tell me. But thank you for the information Will be prepared to receive

0

This is a great content. Thank you very much.

<a href="https://ufaz88movie.com/Vagabond-2020-%E0%B9%80%E0%B8%88%E0%B8%B2%E0%B8%B0%E0%B9%81%E0%B8%9C%E0%B8%99%E0%B8%A5%E0%B8%B1%E0%B8%9A%E0%B9%80%E0%B8%84%E0%B8%A3%E0%B8%B7%E0%B8%AD%E0%B8%82%E0%B9%88%E0%B8%B2%E0%B8%A2%E0%B8%99%E0%B8%A3%E0%B8%81">หนัง hd</a>

 

0

Thanks to you, I've learned a lot about software. Thank you very much.

bubble shooter  G Switch 3

0

It really is a bit strange but useful and informative. Thanks and please find time to check these:

roofing companies bradenton
roof repair st. petersburg
roof repair bradenton

And this as well:

pool enclosures north port
pool enclosures sarasota 

0

It is important to keep the cleaned data of the body. For roofing solutions check these:

screen enclosures sarasota

screen enclosures northport

screen enclosures venice

pool enclosures bradenton

0

用来存放body清洗后的福彩3D 数据。现在业务 上海快3逻辑就是在clean_body中内容为空时,自动到body中去获取北京快3数据。  

0

您的文章内容很棒。 感谢您分享好的信息.ดาวน์โหลด slotxo

0

When students seek Psychology Coursework Writing Services, they are assured of receiving Best Psychology Writing Services and Psychology Research Paper Writing Services that meets all their writing needs. 

 

-1

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

-1

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

-1

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

-1

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

-1

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.

-1

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

192.168.l.l

2

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

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