Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/elixir/2.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
Postgresql PSQL-如何选择两列的组合?_Postgresql_Ibatis - Fatal编程技术网

Postgresql PSQL-如何选择两列的组合?

Postgresql PSQL-如何选择两列的组合?,postgresql,ibatis,Postgresql,Ibatis,我有一个列如下的表: User id integer; firstName varchar; lastName varchar; employee_id integer; User(1,"John","Dake",123) User(2,"John","Daniel",124) User(3,"Richard","Johnson",125) User(4,"Peter","Federo",126) User(5,"George","Daniel",127) 现在,表中

我有一个列如下的表:

User
   id integer;
   firstName varchar;
   lastName varchar;
   employee_id integer;
User(1,"John","Dake",123)
User(2,"John","Daniel",124)
User(3,"Richard","Johnson",125)
User(4,"Peter","Federo",126)
User(5,"George","Daniel",127)
现在,表中的数据如下所示:

User
   id integer;
   firstName varchar;
   lastName varchar;
   employee_id integer;
User(1,"John","Dake",123)
User(2,"John","Daniel",124)
User(3,"Richard","Johnson",125)
User(4,"Peter","Federo",126)
User(5,"George","Daniel",127)
我需要实现一个名-姓组合的搜索。假设搜索查询是johnd,那么输出应该是前两行。是否可以在不创建新视图或表的情况下编写这样的查询来获取输出?

试试这个

SELECT * FROM demo WHERE firstName||' '||lastName LIKE '%John D%'

强制性但仍然重要的相关程序员教育链接,请阅读: