Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
SQL语句相同的值可以在多个字段、同一个表中_Sql - Fatal编程技术网

SQL语句相同的值可以在多个字段、同一个表中

SQL语句相同的值可以在多个字段、同一个表中,sql,Sql,假设我有一个名为people”的表,在该表中,我的值为James,但该值可能位于许多不同的列中,例如: Name1, Name2, Name3, Name4, and Name5 我如何编写一个SQL语句,它将返回值为James的所有行,而不管它在哪一列 select * from your_table where 'James' in (name1,name2,name3,name4,name5)

假设我有一个名为
people
”的表,在该表中,我的值为
James
,但该值可能位于许多不同的列中,例如:

Name1, Name2, Name3, Name4, and Name5
我如何编写一个SQL语句,它将返回值为
James
的所有行,而不管它在哪一列

select * from your_table
where 'James' in (name1,name2,name3,name4,name5)