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.
| Author |
Topic |
|
sql_seeker
Starting Member
1 Post |
Posted - 2010-03-10 : 11:14:06
|
| Hi All,I'm working on SQl Server, and i'm still a learner, i have this small problem which i'm not able to execute. Here is the problem:I have to get a result by performing this operation:SELECT op as 'op' ,jsd as 'jsd' ,( SELECT TOP 1 ABC FROM dbo.xyz WHERE x = 1 AND y = P.y ORDER BY RTY DESC ) AS 'ABC' FROM dbo.xxx DL INNER JOIN dbo.YYYPD ON DL.g= PD.gINNER JOIN dbo.DF P ON PD.h= P.hNow i have to use a CONCAT operation to add '\'+'Name'+'.rar'Now how do i go about doing it? the Name is from another table, and it has to concatenated with the result from the previous query and i have to give the concatenated value AS 'ABC'I tried using the '+' symbol inside the sub query, but i got an error"Msg 512, Level 16, State 1, Procedure cvt1, Line 39Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression."Can you help me?Regards |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-03-10 : 11:32:22
|
Can you show the statement that brings the error? No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
Bustaz Kool
Master Smack Fu Yak Hacker
1834 Posts |
Posted - 2010-03-10 : 11:40:13
|
| Questions: 1) You show Name as a literal but you mention that it comes from a different table. Is it a literal or a column? 2) Is Name the same value for each record returned? 3) Just to confirm - Are you trying to concatenate your string to the ABC value in the subquery? 4) Can you show us the query that is actually failing?BTW, you don't need to define the name of the column if it is the same as the column name (e.g., select op as 'op'); you can just select the column and it will apply that name automatically (e.g., select op).=======================================There are no passengers on spaceship earth. We are all crew. -Marshall McLuhan, educator and philosopher (1911-1980) |
 |
|
|
|
|
|
|
|