Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Update Query

Posted on 2004-09-16
1
Medium Priority
?
145 Views
Last Modified: 2010-04-05
Can anyone tell me why my update query does not work.  I get the error.

Server: Msg 116, Level 16, State 1, Line 17
Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.


UPDATE up
SET up.ref = up.ref,
    up.pdate = up.pdate,
    up.problem = up.Problem,  
    up.Branch    = up.Branch ,
  up.Val =  v.val,
    up.moddate =  v.modified ,  
   up.type  = t.name
from  docsdb.dbo.vtab0010 v,  docsdb.dbo.temp  te,  docsdb.dbo.updated up,  docsdb.dbo.types t
where v.val in
(select  distinct te.ref,
                 te.pdate,
                 v.val,
                 te.problem,
                 te.branch,
               v.modified,
               t.name
           from   docsdb.dbo.vtab0010 v      
           join   docsdb.dbo.docs d on v.docid = d.docid
           join   docsdb.dbo.types    t on d.typid = t.typid
           join   docsdb.dbo.temp     te on v.val = te.val
           inner join (select v.val, max(v.modified) as modified from docsdb.dbo.vtab0010  v group by v.val)
           x on v.val = x.val and v.modified = x.modified
           where  (v.val = te.val and te.problem = 'No Card'))
0
Comment
Question by:running32
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 13

Accepted Solution

by:
BlackTigerX earned 2000 total points
ID: 12079886
your problem is here:

where v.val in
(select  distinct te.ref,
                 te.pdate,
                 v.val,
                 te.problem,
                 te.branch,
              v.modified,
              t.name

v.val IN ALL THOSE values, you can only have ONE value in your select statement, so it needs to be something like:

where v.val in
(select  v.val,
            ...etc...
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question