Solved

Update Query

Posted on 2004-09-16
1
138 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
1 Comment
 
LVL 13

Accepted Solution

by:
BlackTigerX earned 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

895 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now