Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 11-19-2009, 10:59 PM   #1
Registered: Jul 2009
Posts: 53

Rep: Reputation: 15
one question in mysql

Dear All,
I have a question in mysql and iam not very sure if this is the right plcae to post my question.Anyways, my question is

I have two rows where i have two instances of time.(iam posting my table below). I would like to know how to retreive the time difference between the two.I googled n gotta know that TIMESTAMPDIFF function can be used.

| C1 | C2| A2.|...........time...... |.A3..|.A4.|.A5|dst_domain|
| 26 |BYE|200 | OK| 2009-11-18 14:21:18 | 200 |100 |100| |
| 25 |ACK|200 | OK| 2009-11-18 14:21:15 | 100 |200 |200| |

In short i would like to get the time difference between 14:21:18 and 14:21:15
Old 11-19-2009, 11:32 PM   #2
Senior Member
Registered: May 2008
Distribution: Slackware
Posts: 1,049

Rep: Reputation: 70
Just curious but what kind of database is that? I'm just now using postgresql and learning the ropes. That database looks interesting. Is it for benchmarking networking latencies?
Old 11-20-2009, 01:16 AM   #3
Registered: Jul 2009
Posts: 53

Original Poster
Rep: Reputation: 15
NOt really.. this is related to telephone-billing... any ideas how to retreive the duration(the difference between the two time inputs given)?..
Old 11-20-2009, 01:27 AM   #4
Registered: Apr 2009
Location: ~
Distribution: RHEL, Fedora
Posts: 381

Rep: Reputation: 58
Many functions available in mysql

Old 11-20-2009, 10:53 AM   #5
Senior Member
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
If they're stored properly as date/time fields, you might just try a simple subtract as well.
DBs usually internally store the date/times as numbers.

The problem would be that they are in separate rows and queries are usually row-based.
You may need some stored procedure for that, or use some custom scripting, rather than the DB.

For what purpose do you need the time diff?


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
linux distro question & mysql install question natalie.aloi Linux - Newbie 5 07-19-2009 08:28 PM
Can MySQL log on via SSH/bash? mysql:x:27:101:MySQL Server:/var/lib/mysql:/bin/bash Ujjain Linux - Newbie 2 04-24-2009 02:21 PM
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. SpellChainz Linux - Newbie 1 06-23-2007 03:35 PM
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. Dannux Linux - Software 3 03-24-2006 08:44 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:09 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration