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

0
PostgreSQL 数据库 40267 次浏览

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

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

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

50个答案

默认排序 按投票排序
0

exactly same problems i was facing for the last one week thanks for asking this somebody will help us

From Professional dissertation writing service

0

ขอบคุณมากสำหรับข้อมูล

กรุณาเยี่ยมชมเว็บไซต์ของฉัน
jav

0

Thank you for letting me post here. 

https://www.housecleanersk.ca/commercial.html

0

There is just one detail you left out in your master plan, and it is staring right at you as you open your front door – your home is in an absolute mess!

<a href="https://www.housecleanersk.ca/commercial.html">Saskatoon office cleaning service</a>

0

谢谢您提供这样的好信息。pg slot true wallet  如何在PostgreSql数据中SELECT的时候A插入如果内容空就返回B的内容?

0

Thanks for your question, lots of good answers.

candy crush saga

0

very interesting concept, very leading edge. learning all types of coding tips recently, so thank you! www.insulationvictoria.com 

0

How to insert real time incoming data to postgresql in real time? thanks in advance. landscape maintenance company

0

在 PostgreSQL 中,当我们需要根据指定条件从单张表或者多张表中查询数据时,就可以在 SELECT 语句中添加 WHERE 子句,从而过滤掉我们不需要数据。

WHERE 子句不仅可以用于 SELECT 语句中,同时也可以用于 UPDATE,DELETE 等等语句中。

语法
以下是 SELECT 语句中使用 WHERE 子句从数据库中读取数据的通用语法:pg

0

คอมโพเนนต์รายการคือกล่องรายการตัวเลือกเดียวหรือหลายรายการที่เลื่อนได้ คอมโพเนนต์รายการใช้ดัชนีที่อิงเป็นศูนย์โดยรายการที่มีดัชนี 0 poipet

0

To anyone getting an error when using the psql command in Windows Terminal. remodeling contractors middle GA

0

Well resolving such issues is important because of many reasons. Thanks! stlouistreeco.com

0

Thank you for your post. I have read through some similar topics! However, your article gave me a very special impression, unlike other articles. I hope you continue to have valuable posts like this or more to share with everyone! tetris

0

Very Informative, since PostgreSQL is mostly used on Linux systems right? correct me if im wrong. Bathroom Remodeling Brooklyn NY

0

Keep the outside of your entire house looking spotless with our Tallahassee control washing administrations! Here is the conclusive list of Tallahassee's power washing administrations as appraised by the Tallahassee, FL pros.

0

Lubbock's Top Power Washing Business. 

0

Gladly advertising the most elevated quality outside pressure washing, control clearing, and commercial cleaning administrations in Lubbock & encompassing ranges. Call Right Now. 

0

really good and very explainable series of postgresql. small excavator service

0

I would appreciate it if somebody can tell me where to dowload it, thanks. abrasive blasting

0

PG Slot  true wallet

1 2 3