6

若有2个取值 优先取其中一个的SQL怎么写

 2 years ago
source link: https://www.oschina.net/question/1175066_2325591
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

若有2个取值 优先取其中一个的SQL怎么写

zgw06629 发布于 04/12 15:28
阅读 651
sql

这种sql怎么写呢 

需求:若有mark=1和2同时存在的数据,则优先取mark=1(合并调整)的数据

List list  = getByMark(1);

if list not empty

    reurn list

return getByMark(2)

能否通过一条SQL语句 来实现这个目的呢


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK