| 注册
请输入搜索内容

热门搜索

Java Linux MySQL PHP JavaScript Hibernate jQuery Nginx

如何在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)然后在代码中自己判断也是可以的,这样做总觉得怪怪的,如果在数据库一层就可以做到的话是最完美的!

91个答案

0

While curing, spray foam emits a gas that causes blurred vision and trouble breathing. 
Boise soundproofing insulation

0

Body content.. thanks a lot

 

https://marriagecounselinglubbock.com

0

很棒的帖子!感谢分享。local website design company

0

Thanks for sharing the post ดาวน์โหลด slotxo

0

Thanks for sharing the post สมัคร slotxo

0

Thanks for sharing the post ฝากถอน slotxo

0

Thanks for sharing the post ดาวน์โหลด slotxo

0

Thanks for sharing the post ดาวน์โหลด slotxo

0

Thanks for sharing the post สมัคร slotxo

0

Thanks for sharing the post สมัคร slotxo

0

Thanks for sharing the post ฝากถอน slotxo

0

Thanks for sharing the post ฝากถอน slotxo

0

I've spent ages looking for this on the web. Thank God someone did post it. 

Spray Foam

0

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

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

0

Your article is great, thank you for sharing them!

jigsaw puzzles

0

Great article, hope you will have more articles with many good topics to give readers. minesweeper

0

If you are looking for A Spring Mass Excited By A the best place to get it would be ScholarOn. All questions including A 500 Foot Long Steel Cable are listed with complete solutions with exclusive offers on problems like 23 Which Of The Following Might, all under a single subscription.

0

Your article is great, thank you for sharing them!

jigsaw puzzles

0

This is definitely of the best article discussing about PostgreSql, thank you so much! This bathroom contractors des moines is the one I hired for all my bathroom remodel needs for my home and apartments.

0

Think you can keep up? Who am I kidding... You know you can't keep up.

1 2 3 4 5