Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 How to solve this condition?

Author  Topic 

kabon
Starting Member

48 Posts

Posted - 2013-03-07 : 23:05:51
I used condition for example
where mur.RECID in (SELECT [COLUMN 0] COLLATE SQL_Latin1_General_CP1_CI_AS FROM CTMURATALL WHERE FIN_MAT_DATE > (select a.XMLRECORD.value('(/row/c1)[1]','NVARCHAR(100)') from t24testsby.dbo.F_DATES as a))

and error out like this
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.

do you know how to solve that?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-03-08 : 00:10:17
i think its the below subquery returning multiple records

(select a.XMLRECORD.value('(/row/c1)[1]','NVARCHAR(100)') from t24testsby.dbo.F_DATES as a)

run it alone and check
also in case it returns multiple, you may consider applying some form of aggregation to get this working

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

kabon
Starting Member

48 Posts

Posted - 2013-03-08 : 01:31:42
yeah i think it's multiple records, but i must take from that table and that column...
can you help me?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-03-08 : 01:38:13
how can i? i dont know how your data is and what you're trying to attempt and you've not given any info also for anyone to help.

If you can provide details in below format i'll try

http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

kabon
Starting Member

48 Posts

Posted - 2013-03-08 : 01:46:46
i have table like this

column 1 | column 2 | date |
a |123 |20130308|
b |234 |20130308|
c |567 |20130209|
d |145 |20130308|

i must show with condition that the date must 20130308 and take from other table. and this is the table to take the date :

ID |date |
A1 |20130308|
A2 |20130308|
A3 |20130308|
A4 |20130308|

i just want to take the that from that table, can you help me?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-03-08 : 05:30:53
so what should be your final output? if you just join on date, as per current table structure you will get duplicate entries for each column_1 value

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -