: Substraction
Brian,
create table test(id int unsigned);
insert into test values(10);
select 15 - id from test;
The result is 18446744073709551611 instead of -5.
Trying to confirm this with MySQL 4.0.7 on a Win2K box:
mysql create table test(id int unsigned);
Query OK, 0 rows
) [EMAIL PROTECTED]
To: Brian Lindner [EMAIL PROTECTED]; Octavian Rasnita
[EMAIL PROTECTED]
Cc: MySQL [EMAIL PROTECTED]
Sent: Monday, January 20, 2003 1:09 AM
Subject: Re: Substraction
Brian,
create table test(id int unsigned);
insert into test values(10);
select 15 - id from test
]
To: Stefan Hinz, iConnect (Berlin) [EMAIL PROTECTED]; Brian
Lindner [EMAIL PROTECTED]
Cc: MySQL [EMAIL PROTECTED]
Sent: Monday, January 20, 2003 08:22
Subject: Re: Substraction
But I don't want to perform a 15 - id, meaning 15 - 10.
I want to calculate 5 - id, meaning 5 - 10.
It should give me -5
On Monday 20 January 2003 08:22, Octavian Rasnita wrote:
But I don't want to perform a 15 - id, meaning 15 - 10.
I want to calculate 5 - id, meaning 5 - 10.
It should give me -5 or 5 but not | 18446744073709551611 |
The result of the above expression is UNSIGNED, because column 'id' is INT
$58e8dda0$[EMAIL PROTECTED]
[EMAIL PROTECTED]
00ad01c2c010$45ee73a0$dc4fc7d9@mephisto
006001c2c09a$9a4fc1d0$[EMAIL PROTECTED]
Subject: Re: Substraction
Date: Mon, 20 Jan 2003 19:15:33 +0200
MIME-Version: 1.0
Content-Type: text/plain;
charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X
Hi all,
I've tried the following query:
create table test(id int unsigned);
insert into test values(10);
select 15 - id from test;
The result is 18446744073709551611 instead of -5.
Am I doing something wrong?
Thank you.
Teddy,
Teddy's Center: http://teddy.fcc.ro/
Email: [EMAIL PROTECTED]
Octavian,
Sunday, January 19, 2003, 7:31:57 AM, you wrote:
Hi all,
I've tried the following query:
create table test(id int unsigned);
insert into test values(10);
select 15 - id from test;
The result is 18446744073709551611 instead of -5.
I ran this.. and it worked for me
MySql 4.0.7
Rasnita [EMAIL PROTECTED]
CC: MySQL [EMAIL PROTECTED]
Subject: Re: Substraction
In-Reply-To: 001901c2bfe4$58e8dda0$[EMAIL PROTECTED]
References: 001901c2bfe4$58e8dda0$[EMAIL PROTECTED]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Octavian,
Sunday
: Sunday, January 19, 2003 10:28 PM
Subject: Re: Substraction
Octavian,
Sunday, January 19, 2003, 7:31:57 AM, you wrote:
Hi all,
I've tried the following query:
create table test(id int unsigned);
insert into test values(10);
select 15 - id from test;
The result
On Sun, 2003-01-19 at 19:09, Nasser Ossareh wrote:
Isn't there a typo somewhere...
Shouldn't you expect 5 instead of -5 (15 - id where id = 10)??
Nevermind, let's assume that there is a typo somewhere and the correct expected
value is -5... however, in the domain of unsigned arithmetics
You can't just subtract datetime fields. Check the date and time functions
in the manual.
Jim Hogan wrote:
Hello!
I am working on an analysis that is very much dependent on calculating
time differences in seconds. The most simple example:
I have 3 variables: time_begin (DATETIME) time_end
Jim,
Sunday, November 03, 2002, 8:44:43 PM, you wrote:
JH I am working on an analysis that is very much dependent on calculating
JH time differences in seconds. The most simple example:
JH I have 3 variables: time_begin (DATETIME) time_end (DATETIME) and elapsed_
JH seconds (INT). The data
On Mon, 4 Nov 2002, gerald_clark wrote:
You can't just subtract datetime fields. Check the date and time
functions
in the manual.
Thanks,
I should know I run the risk of posting a RTFM/FAQ when I'm tired!
I got off track by misinterpreting In MySQL Version 3.23, you can use +
and - instead
Hello.
On Sun 2002-11-03 at 10:44:43 -0800, [EMAIL PROTECTED] wrote:
Hello!
I am working on an analysis that is very much dependent on calculating
time differences in seconds. The most simple example:
I have 3 variables: time_begin (DATETIME) time_end (DATETIME) and elapsed_
seconds
: Re: mysql DATETIME substraction problem/?
Hello.
On Sun 2002-11-03 at 10:44:43 -0800, [EMAIL PROTECTED] wrote:
Hello!
I am working on an analysis that is very much dependent on calculating
time differences in seconds. The most simple example:
I have 3 variables: time_begin (DATETIME
Hi.
On Mon 2002-11-04 at 15:24:19 -0600, [EMAIL PROTECTED] wrote:
More appropriately, use curdate()feature from within sql.
select * where date= curdate()-1;
Two points:
- How does this relate to the origianl question? He wanted to know how
to calculate a time interval.
- The above has
Hello!
I am working on an analysis that is very much dependent on calculating
time differences in seconds. The most simple example:
I have 3 variables: time_begin (DATETIME) time_end (DATETIME) and elapsed_
seconds (INT). The data in these DATETIMES looks fine -MM-DD HH:MM:SS
as
Hi,
On Mon, 2002-02-18 at 00:40, [EMAIL PROTECTED] wrote:
I want to do substraction between tables in mysql,
MINUS not yet implemented in mysql
and this not work :
select a.* from table_a a where a in (select * from table_b)
Please post the structure of both tables. Then we can post you
18 matches
Mail list logo