case的时候,mysql与同一列有多个where条件

时间:2017-07-15 06:38:28

标签: mysql case

我有一张桌子数据。我试图在mysql查询时使用大小写的基于三个条件的同一列的数据。 但没有按预期给出结果。 我的表:

it('mousedown on the div', inject([MyService], service) => {
     debugEle[0].triggerEventHandler('mousedown',{pageX:50, pageY: 40});
     debugEle[0].triggerEventHandler('mousemove',{pageX:60, pageY: 50});
     // assuming you are calculating the difference between the second and first objects.
     expect(service.someObj).toBe({x:10, y:10});
 });

我希望结果如下格式化。

id  bundle_id   asset_id    price_id    customer_id  weekday_am     weekend_am 
1       1           1           1                       100.00          120.00
2       1           2           1                       150.00          140.00
3       1           1           1                       0.00            0.00
4       1           1           2                       0.00            145.00
5       1           2           2                       140.00          0.00
6       1           1           2                       0.00            0.00
7       1           1           3           5           140.00          120.00
8       1           2           3           5           0.00            140.00
9       1           1           3           5           130.00          0.00

但我的查询无效:

bundle_id   asset_id    weekday_am      weekend_am
1           1               140.00          120.00
1           2               150.00          140.00
1           1               130.00          0.00

有人可以帮帮我吗?谢谢。

1 个答案:

答案 0 :(得分:0)

尝试编辑

WHEN weekday_am IS NULL  or weekday_am = 0.00  where customer_id = 5 and price_id = 3 THEN weekday_am

WHEN weekday_am IS NULL  or weekday_am = 0.00  and customer_id = 5 and price_id = 3 THEN weekday_am

ELSE weekday_am 

与weeken_am相同