sql server - SQL error Subquery returned more than 1 value -
i got following error when change planningdate period. because of 1 planningtime has more 1 "programmetitle, title". tried change join, can't expect result. please help
msg 512, level 16, state 1, line 1 subquery returned more 1 value. not permitted when subquery follows =, !=, <, <= , >, >= or when subquery used expression.
select pt.planningtime, (select (ltrim(rtrim(programmetitle+':'+title))) planning channelid = '34' , convert(char(8),planningdate,112) between '20130101' , '20130107' , pt.planningtime = planningtime , datepart(dw,planningdate)=1) title1, (select (ltrim(rtrim(programmetitle+':'+title))) planning channelid = '34' , convert(char(8),planningdate,112) between '20130101' , '20130107' , pt.planningtime = planningtime , datepart(dw,planningdate)=2) title2 planningtime pt pt.channelid = '34' , convert(char(8),pt.planningdate,112) between '20130101' , '20130107'
it clear sub query returns more 1 value , cant query result way. must find other way query results per table structure. think 1 of sub-query in query returns more 1 result, how select work? that's it.
Comments
Post a Comment