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

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -