| 注册
请输入搜索内容

热门搜索

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

184个答案

0

Thank you for joining our website.50รับ150

0
0

Thank you for joining our 1st website now.10รับ100

0

Thank you for joining.ฝาก19รับ100

0

From my point of view, PostgreSql data is the easiest thing to do for an advanced level programmer. Sometimes a cheap essay writing service can provide satisfactory results. This basic-level language has made it easier for us to increase the effectivity of human-machine interaction. Visit - Assignment Help

 Comment   

0
0
0
0
0
0
0
0

If you read out the contents of the two fields directly (select body, clean_body from content) and then judge by yourself in the code, it is always weird to do so, if it can be done in the database layer, it is the most perfect of!

Add a Guest House, Efficiency Apartment, In-Law Suite, & More

0
0
0
0

In my relaxing time, I often look to small games for entertainment, they do not consume my time. But not every game I play. But I wanted to find games that were really attractive because that made me forget all around to really "focus on entertainment", which I really needed at that time. That helps me relax completely before continuing to work. That, to me is good! And I often choose Impossible Game to serve my relaxing time!

0
0

I wanted to thank you for this excellent read!! I definitely loved every little bit of it. I have you bookmarked your site to check out the new stuff you post. 메이저토토

0
1 2 3 4 5 6 7 8 9 10