我有以下结构的数据透视表:
| keyx | value | name | id | form_no |
-----------------------------------------------
| hour | 01 | Ali | 12 | 100000001 |
-----------------------------------------------
| min | 00 | Ahmad | 17 | 100000001 |
-----------------------------------------------
| hour1 | 03 | John | 21 | 100000001 |
-----------------------------------------------
| min1 | 01 | Mike | 33 | 100000001 |
-----------------------------------------------
| hour | 01 | Homa | 76 | 100000002 |
-----------------------------------------------
| min | 02 | Omid | 73 | 100000002 |
现在我想从表格(my_table)中选择name,id,form_no
,但请检查keyx = 'hour' and value = '01' and keyx = 'min' AND value = 'oo' and form_no = '100000001'
是否正确。因此,我可以使用WHERE CASE
或WHERE IF
。感谢您的指导和帮助。
答案 0 :(得分:0)
试试这样: -
select name,id,form_no from table(my_table) where keyx in ('hour','min') and value in (01,00) and form_no= 100000001;