SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 How to solve this condition?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

kabon
Starting Member

Indonesia
48 Posts

Posted - 03/07/2013 :  23:05:51  Show Profile  Reply with Quote
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

India
52317 Posts

Posted - 03/08/2013 :  00:10:17  Show Profile  Reply with Quote
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

Indonesia
48 Posts

Posted - 03/08/2013 :  01:31:42  Show Profile  Reply with Quote
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

India
52317 Posts

Posted - 03/08/2013 :  01:38:13  Show Profile  Reply with Quote
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

Indonesia
48 Posts

Posted - 03/08/2013 :  01:46:46  Show Profile  Reply with Quote
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

India
52317 Posts

Posted - 03/08/2013 :  05:30:53  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000