开发者

Using the case when then in sqlite and php

开发者 https://www.devze.com 2023-03-21 04:43 出处:网络
Hi I\'m battling to understand how to use the syntax of cases in sqlite. What I\'m trying to do If Monday is in column 5 th开发者_运维百科en show value in column 1 for the same row.

Hi I'm battling to understand how to use the syntax of cases in sqlite.

What I'm trying to do

If Monday is in column 5 th开发者_运维百科en show value in column 1 for the same row.

So for every row that has Monday in column 5 it will show the value of column 1.

Hope that makes sense

Thanks

EDIT

ID    SHOW NAME    AIRS   
1     The Test     Monday
2     Wrong        Tuesday

So it must look through AIRS and then it finds Monday and outputs the corresponding show name - The Test


So you want to show all shows that air on Monday? No need for fancy CASE.

SELECT `SHOW NAME` FROM shows WHERE AIRS="Monday"

$sql = "SELECT `SHOW NAME` FROM shows WHERE AIRS='".$test."'"
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号