473,808 Members | 2,758 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Insert Into Table Using Field Criteria

2 New Member
This seems like it would be a straightforward function, but after searching all morning I'm a bit stuck.

Into an exsiting db, I'd like to update a field (called "week") in rows with certain dates (listed in another field called "time"). The table is called "digi".

Here's what I tried, but it appears that this should be pulling the data from a second table. Is ther a way to send the data, in this case very simple "3" to the rows with specific dates?

Expand|Select|Wrap|Line Numbers
  1. INSERT INTO digi SET week='3' WHERE time BETWEEN '2008-01-14 00:00:04' AND '2008-01-16 02:40:04';
Any guidence would be greatly appreciated.
Jan 17 '08 #1
1 2243
vinic
2 New Member
This seems like it would be a straightforward function, but after searching all morning I'm a bit stuck.

Into an exsiting db, I'd like to update a field (called "week") in rows with certain dates (listed in another field called "time"). The table is called "digi".

Here's what I tried, but it appears that this should be pulling the data from a second table. Is ther a way to send the data, in this case very simple "3" to the rows with specific dates?

Expand|Select|Wrap|Line Numbers
  1. INSERT INTO digi SET week='3' WHERE time BETWEEN '2008-01-14 00:00:04' AND '2008-01-16 02:40:04';
Any guidence would be greatly appreciated.

Sorted this on my own. Found the update function could do this:

Expand|Select|Wrap|Line Numbers
  1. UPDATE digi SET week=3 WHERE time BETWEEN '2008-01-14 00:00:04' AND '2008-01-16 02:40:04';
Sorry to take up space..... maybe this'll help another noob sometime.
(or me, when I'm looking for the same answer next year!)

Offward!!! UnChristian Soldiers.
Jan 17 '08 #2

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

Similar topics

0
1776
by: lea | last post by:
I have two combobox, I let the user to select report criteria FROM xx TO xx. i have a button call btnPrint to select report criteria and print according to the criteria. I able to SELECT the record based on the report criteria but i dunno how to print it out with the use of crystal report,because for my knowledge, Crystal report is only can retrieve all Records in the Table with generated dataset.
3
7284
by: takilroy | last post by:
Hi, Does anyone know of a simple way to do this? I want to create an insert trigger for a table and if the record already exists based on some criteria, I want to update the table with the values that are passed in via the insert trigger without having to use all the 'set' statements for each field (so if we add fields in the future I won't have to update the trigger). In other words, I want the trigger code to look something like...
16
17026
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums must be UPDATED, if not, they must be INSERTED. Logically then, I would like to SELECT * FROM <TABLE> WHERE ....<Values entered here>, and then IF FOUND UPDATE <TABLE> SET .... <Values entered here> ELSE INSERT INTO <TABLE> VALUES <Values...
3
1601
by: colmobrien | last post by:
Help Needed ms access 2000 I have a table where one field is the year end monthr (January, February,........, December) and another field is the year end day (1,2,3,........,31) i want to create a query which gets the month and date and returns all records where Year end month = user input (eg April) and year end day <= user input (eg 5)
4
10299
by: wizof103 | last post by:
When I try to insert a new record on a form, I get the following error. " You can't go to the specified record". The iInsert/New Record command is not available. Any ideas. Thanks in a dvance
33
2524
by: Geoff Jones | last post by:
Hiya I have a DataTable containing thousands of records. Each record has a primary key field called "ID" and another field called "PRODUCT" I want to retrieve the rows that satisy the following criteria: I have a list of about 100 numbers which correspond to the ID field and also another 40 say numbers corresponding to the numbers in the PRODUCT field. I want to show the rows that correspond to both these criteria.
3
6340
by: Bob Alston | last post by:
I have a routine to copy data to new versions of my app via insert into sql statements. Unfortunately, due to evolution of my app, sometimes the new version has more restrictive editing than an older version that I am updating. Thus I get this message. It tells me only how many records have errors, not which errors or which records. Anyone have a nice solution to identifying the specific records involved? Maybe even the specific...
1
5251
by: Jan | last post by:
I have a table with autoincrement unique ID plus name (required not to be blank) and other fields. I have a list of names in another table and would like to do insert to the name field of the other table. How do I do it? I get error messages when trying different approaches. In the end, I removed the unique key/autoincrement, inserted and ID field in the source and then did copy&append records in the edit menu and changed it all back....
2
4801
by: David - Australia | last post by:
G'day from Australia, I'm hoping some bright spark may be able to help me with this one. I'm sure that it can be done, I've just hit a wall with it. So I'm opening it up. I'm storing student competencies for a given number of performance criteria (which are stored in a separate reference table). Students are rated competent or not (yes/no field) on up to 5 assessments - Task, Observation, Project, Practical Test, Exam for
0
9721
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9600
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10631
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10374
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7651
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6880
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5548
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4331
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3011
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.