Hi,
I have a table with 3 columns, something like...
NAME, VALUE, DATE, (String(255), int(11), int(11)).
And for argument lets say the data is
row[0] = "A", 10, 1076968526
row[1] = "A", 10, 1076710733
row[2] = "A", 10, 1076709644
I want to update the row where the name = "A" and set the value to 11. But i
only want to update the latest date, (row[0]), in this case where DATE is
the higher.
How would i run a query to update a row where one on the value is the
highest.
Many thanks
Sims 2 2079
On Tue, 17 Feb 2004 07:44:10 +0200, "Sims" <si*********@ho tmail.com>
wrote: Hi,
I have a table with 3 columns, something like...
NAME, VALUE, DATE, (String(255), int(11), int(11)).
And for argument lets say the data is
row[0] = "A", 10, 1076968526 row[1] = "A", 10, 1076710733 row[2] = "A", 10, 1076709644
I want to update the row where the name = "A" and set the value to 11. But i only want to update the latest date, (row[0]), in this case where DATE is the higher. How would i run a query to update a row where one on the value is the highest.
According to: http://www.mysql.com/doc/en/UPDATE.html
you should be able to write
update table set value=11 where name='A' order by date desc limit 1
but I haven't tried it.
There is a bit which explains differences in the behaviour of LIMIT
between MySQL versions. Check that carefully for your version.
--
David ( @priz.co.uk )
Each of those records should have a primary key, so after you have read the
record(s) in and decided which one you want to update it is a simple matter
of issuing the following query:
UPDATE table SET value='11' where pkey='value'.
If you will always want to update the record with the latest date then you
can ensure that it is returned as the first row with the following query:
SELECT * FROM table ORDER BY date DESC LIMIT 1
--
Tony Marston http://www.tonymarston.net
"Sims" <si*********@ho tmail.com> wrote in message
news:c0******** *****@ID-162430.news.uni-berlin.de... Hi,
I have a table with 3 columns, something like...
NAME, VALUE, DATE, (String(255), int(11), int(11)).
And for argument lets say the data is
row[0] = "A", 10, 1076968526 row[1] = "A", 10, 1076710733 row[2] = "A", 10, 1076709644
I want to update the row where the name = "A" and set the value to 11. But
i only want to update the latest date, (row[0]), in this case where DATE is the higher. How would i run a query to update a row where one on the value is the highest.
Many thanks
Sims
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: laurie |
last post by:
Hi all,
I'm trying to help out a friend who has inherited a client with a PHP
shopping cart application. Neither of us know PHP, but I've been
muddling my way through, trying to get these old scripts working on a
new server with the most recent version of PHP. I've pretty much
taken care of all the various errors that were popping up. Most only
pointed out out non-fatal undefined or assumed variables. I've been
able to cure most of...
|
by: Ken Bush |
last post by:
How can I write an update query that removes part of a field? Like if I
have a field with values such as 8/3/68 (a birthday obviously) and I need
to put values in a new column but I need everything after and including the
final / removed to end up with simply 8/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)
|
by: Maxi |
last post by:
There is a lotto system which picks 21 numbers every day out of 80
numbers.
I have a table (name:Lotto) with 22 fields (name:Date,P1,P2....P21)
Here is the structure and sample data:
"Date","P1","P2","P3","P4","P5","P6","P7","P8","P9","P10","P11","P12","P13","P14","P15","P16","P17","P18","P19","P20","P21"
1/1/2005,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21
1/2/2005,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22
|
by: aaron.kempf |
last post by:
team
so i have a nice little list in sharepoint.. about 15k items
i've got the simplest little join statement in access; and im trying to
UPDATE the sharepoint list via an access query.
so im joining between my access table and then sharepoint list and i
get the infamous 'numeric field overflow'.
| |
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 which indexes
computer magazine articles for personal reference.
I am developing a Visual Basic.NET program whose sole
purpose is to enter new records into the database. No
updates to existing entries, no deletions, and no display
|
by: cover |
last post by:
I have an input form that passes data when submitted to a second form
to let the user know what they have just entered into the db.
My question comes with using 'update'. I'd like to query the database
by equipment number (equipno is unique) and query all fields from that
row, populating an original form 'look alike' whereby the user can add
detail to the original records as the db builds. I'm using 'date'
twice because I'd like to...
|
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 http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Order Record</title>
<meta name="Microsoft Border" content="tlb, default">
</head>
|
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...
|
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,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
| |
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...
|
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
|
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...
| | |