我想检查no no列中的给定名称。我在下面发布了我的表记录结构。我想过滤给定名称的已批准列表详细信息。
Name forward1 forward2 forward3 forward4 forward5 status
Ajay vino arun jose Approved
Hersone arun jose Pending
Stefi vino jose arun Approved
Alex arun Hersone vino Approved
我需要拥有批准状态的Jose记录,如下所示:
Name forward1 forward2 forward3 forward4 forward5 status
Ajay vino arun jose Approved
Stefi vino jose arun Approved
这个领域的新手。请帮我这样做。对不起我的英文
答案 0 :(得分:0)
这应该有效:
SELECT *
FROM my_table
WHERE status= 'Approved' AND
(forward1 LIKE '%jose%' OR
forward2 LIKE '%jose%' OR
forward3 LIKE '%jose%' OR
forward4 LIKE '%jose%' OR
forward5 LIKE '%jose%');
编辑:WHERE condition
取决于您的要求
要获得完全匹配,您可以使用forward1 = 'jose'
答案 1 :(得分:0)
请尝试以下:
SELECT *
FROM tableA
WHERE status= 'Approved' AND
(forward1 ='jose' OR forward2 ='jose' OR forward3 ='jose'
OR forward4 ='jose' OR forward5 ='jose');
答案 2 :(得分:0)
query = select * from table_name where forward3 = 'jose' and status = 'approved'