Subquery returns more than 1 row查询结果多于一行

例如 :WHERE(" use_id =(select user_id from store_staff where store_id="+ store_id + ")");

改为  WHERE(" use_id =any(select user_id from store_staff where store_id="+ store_id + ")");

时间: 2024-08-11 21:29:53

Subquery returns more than 1 row查询结果多于一行的相关文章

解决"Subquery returns more than 1 row"sql查询错误

http://blog.csdn.net/c517984604/article/details/7052186 [Err] 1242 - Subquery returns more than 1 row   --表示子查询返回了多行数据 例如: select * from table1 where table1.colums=(select columns from table2) 解决方法 1,select * from table1 where column=any(select colum

错误代码: 1242 Subquery returns more than 1 row

1. 错误描述 1 queries executed, 0 success, 1 errors, 0 warnings 查询:SELECT t.id, DATE_FORMAT( t.statisTime, '%Y-%m-%d %H:%i:%s' ) statisTime, (SELECT `id` FROM t_truck_info WHERE id = t.plateId... 错误代码: 1242 Subquery returns more than 1 row 执行耗时 : 0.009 s

mysql 报错 ‘u'Subquery returns more than 1 row'’

watch_course_sql = """select DATE_FORMAT( FROM_UNIXTIME(a.CreateTime / 1000) , '%%Y-%%m-%%d %%T') regtime, a.username FROM bskuser a where a.UserName in (select username from bskchapterlist where lessonid = (select id from bsklesson a WHERE

java.sql.SQLException: ORA-01427: single-row subquery returns more than one row

ORA-01427: 单行子查询返回多个行 sql语句如下: select h.operator,       to_char(h.operate_tm, 'yyyy-mm-dd hh24:mi:ss') operate_tm,       (select t.res_label name          from [email protected] t         where t.id = h.system_id) system_id,       (select t.res_label

合并多行查询数据到一行:使用自连接、FOR XML PATH('')、STUFF或REPLACE函数

示例表 tb 数据如下 id value—————1 aa1 bb2 aaa2 bbb2 ccc 第一种 SELECT id, [val]=( SELECT [value] +',' FROM tb AS b WHERE b.id = a.id FOR XML PATH('') ) FROM tb AS a 第一种显示结果 1 aa,bb, 1 aa,bb, 2 aaa,bbb,ccc, 2 aaa,bbb,ccc, 2 aaa,bbb,ccc, 第二种 SELECT id, [val]=( S

SQL Server中如何定位Row Lock锁定哪一行数据

在SQL Server中有时候会使用提示(Hint)强制SQL使用行锁(Row Lock),前两天有个同事咨询了一个问题,如何定位Row Lock具体锁定了哪一行.其实这个问题只适合研究一下,实际意义并不大,因为找到.定位被锁定的行的代价开销较大,而意义却不怎么大,而且使用场景也很少.那么下面我们来探讨.研究一下这个问题吧: 在会话窗口(会话ID=65)下执行下面SQL语句,模拟SQL Server使用行锁锁定某一行记录: USE AdventureWorks2012; GO   SELECT 

623. Add One Row to Tree 将一行添加到树中

Given the root of a binary tree, then value v and depth d, you need to add a row of nodes with value v at the given depth d. The root node is at depth 1. The adding rule is: given a positive integer depth d, for each NOT null tree nodes N in depth d-

sql example 9 -- 子查询

sql example 9 – 子查询 sql example 9 – 子查询 数据库准备 create table student ( id int auto_increment primary key, name varchar(10) ); create table scores ( id int auto_increment PRIMARY key, score int default 0, foreign key (id) references student(id) on delet

[Oracle系列整理01]PL/SQL 基本查询与排序

本课重点:    1.写SELECT语句进行数据库查询    2.进行数学运算    3.处理空值    4.使用别名ALIASES    5.连接列    6.在SQL PLUS中编辑缓冲,修改SQL SCRIPTS    7.ORDER BY进行排序输出.    8.使用WHERE 字段. 一.写SQL 命令:      不区分大小写.      SQL 语句用数字分行,在SQL PLUS中被称为缓冲区.      最后以:或 / 结束语句.      也可以用RUN来执行语句 二.例1: