473,320 Members | 1,883 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

update date in one tabe with year from table1 and md table 2

When running the following query get this results. can any one help?

Server: Msg 512, Level 16, State 1, Line 1
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
The statement has been terminated.


Expand|Select|Wrap|Line Numbers
  1. update immunizations
  2. set recall_dosedate =
  3.        (select cast(cast(year(i.recall_dosedate) as varchar) + '-' +
  4.               cast(month(e.dateofhire) as varchar) + '-' +
  5.               cast(day(e.dateofhire) as varchar) as datetime)
  6.        from immunizations i, employee e
  7.       where  i.employeeno =  e.employeeno
  8.             and i.recall_dosedate = '2008-01-02 00:00:00.000'
  9.             and i.recall_immcode = 'TBSymSurAn')
  10.            where  recall_dosedate = '2008-01-02 00:00:00.000'
  11.             and recall_immcode = 'TBSymSurAn'
have 79 recors with TBsymsuran only one for a employee. have another immcode that effect 1400 employee, agin only one per employee.
Aug 28 '07 #1
2 1166
Purple
404 Expert 256MB
Hi merrita,

Expand|Select|Wrap|Line Numbers
  1. (select cast(cast(year(i.recall_dosedate) as varchar) + '-' +
  2. cast(month(e.dateofhire) as varchar) + '-' +
  3. cast(day(e.dateofhire) as varchar) as datetime)
  4. from immunizations i, employee e
  5. where i.employeeno = e.employeeno
  6. and i.recall_dosedate = '2008-01-02 00:00:00.000'
  7. and i.recall_immcode = 'TBSymSurAn')
  8. where recall_dosedate = '2008-01-02 00:00:00.000'
  9. and recall_immcode = 'TBSymSurAn'
doesn't appear to be all of the subquery - the error is telling you you are returning multiple records from this query, try running the subquery as a query and see what it returns..

Regards Purple
Aug 28 '07 #2
Purple
404 Expert 256MB
and..

please use code tags when posting sql

Thanks

Purple
Aug 28 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Colleyville Alan | last post by:
I am trying to turn a short and fat (63 columns) table into one that is tall and skinny (7 columns). Basically, I am trying to create a "reverse crosstab" using a looping structure in VBA along...
3
by: Ray | last post by:
Any help? I have two tables. TABLE 1 one which shows all the days of the year with (Number) (date) Each day of the year (Yes/No) TABLE 2 with reservation details with (Autonumber)
0
by: M. David Johnson | last post by:
I cannot get my OleDbDataAdapter to update my database table from my local dataset table. The Knowledge Base doesn't seem to help - see item 10 below. I have a Microsoft Access 2000 database...
4
by: jofo | last post by:
Hello all, I have project form and an hours form and related tables for each. The project table has a status flag to determine if the project is open or closed. When a user enters hours on a...
2
by: Brett | last post by:
My database has 2 tables: Table1 & Table2. If a field is not null on a record in table2, then the not null fields in table1 that correspond to the records in table1 needs to be updated to match the...
6
JKing
by: JKing | last post by:
I'm using an update query to update a single field in a table. Table1 is part of my normalized table structure. Table2 is used solely as an import table for raw data which I sort and summarize...
1
by: teenagelcruise | last post by:
hi, i have a problem with my code which is i cannot update and addnew data into the database but i can delete the data.plz give me an idea.this is my code that i wrote. <html> <head> <meta...
3
by: annecarterfredi | last post by:
I have two tables...Table1(name, date); Table2(appointment_name, name, appointment_date). I want to update appointment_date in Table2 with date from Table1 (business requirement). I am trying to...
25
by: rekhasc | last post by:
hi...... Its very urgent.............. how can i take only the year and month part and it should save in the database in the month and year field separately......... when i enter the date in the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.