Solved

Update Query

Posted on 2004-09-16
1
144 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 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses
Course of the Month6 days, 11 hours left to enroll

623 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