Hi... I am trying to select rows from tblpagerange based on a distinct query in tbldocumentinfo using the following statement:
SELECT tblpagerange.*
FROM tblPageRange
join tbldocumentinfo
on tbldocumentinfo.imageid = tblpagerange.imageid
where tbldocumentinfo.sdocumentnosort = (select distinct sdocumentnosort from tbldocumentinfo where sdocumentnosort between '6587490' and '6587491')
I get the following error:
Server: Msg 512, Level 16, State 1, Line 1
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
I think my query is close, but something just isn't correct in my 'where' statement. Can anyone help me narrow this down?
SELECT tblpagerange.*
FROM tblPageRange
join tbldocumentinfo
on tbldocumentinfo.imageid = tblpagerange.imageid
where tbldocumentinfo.sdocumentnosort = (select distinct sdocumentnosort from tbldocumentinfo where sdocumentnosort between '6587490' and '6587491')
I get the following error:
Server: Msg 512, Level 16, State 1, Line 1
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
I think my query is close, but something just isn't correct in my 'where' statement. Can anyone help me narrow this down?