Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    MYSQL




How To Add X Minutes, Myql Way


i using LOCALTIME() in my mysql codings...
how can i add in mysql X minutes to this time?

mySQLde="UPDATE DTIMES SET TIME=NULL WHERE TIME <" &DATE_ADD(LOCALTIME(),INTERVAL -30 MINUTE)
Microsoft VBScript compilation error '800a03ee'

Expected ')'

mySQLde="UPDATE DTIMES SET TIME=NULL WHERE TIME <" &DATE_ADD(LOCALTIME(),INTERVAL -30 MINUTE)
---------------------------------------------------------------------------------------------^




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
How Do I Insert A Hyperlink In Myql
#1 how one can insert a hyperlink in a table

#2be able to append it to a text area so it becomes automatically added to anything poated to the text area.

Bind Myql 5 With Mysql Php 5
I have php 5 running with mysql 4

I want to bind myql 5 with mysql php 5
(i can run myql5 cosole if i stop myql4)

what suld i do for this

How To Compare An IP Address Belong To A Subnet In Myql?
I am now trying to compare if IP addresses in table1 belong to the corresponding subnets in table2. e.g.

Table 1

name1 192.168.2.123
name2 192.168.0.1
name3 192.168.10.123

.....

Table 2

dept1 192.168.0.0/21
dept2 192.168.8.0/21
....

I want get the result as:

dept1 name1 name2
dept2 name3
.....

So is there any way I can do it ?

Generate HTML &lt; &gt; Tags With Myql String Functions
I have a query like this in that I want to generate an image tag <img src=photo.jpg> when a particular record has an image associated with it.. Here's what the query looks like:

SELEC members.member_id,CONCAT('<img src=',photo,'>') 'Image' FROM members WHERE isAgent=1 order by updated desc

but it keeps outputting the < > as their HTML entities.
&lt;img src=photos/th_244p1010003.jpg&gt;&nbsp;

Any ideas how to have it output the <> so the browser renders the image?

How To Get 15 Minutes Old Records
Scenario :
My system enables a record on zero minute of every hour [through cron job].

Lets suppose right now time is 10:10 AM.

Query:
My query is that ->
1- How can I get all records which are enabled before (1 hour and 15 minutes) of the current time?


DATETIME Was How Many Minutes Ago?
I have a DATETIME stamp in a mysql database and wish to find out how many minutes ago it was... looked across mysql.com for this but no luck.

Running INSERT 1 Or 2 Minutes???
I've been searching the web for code that would INSERT the date and time every 1 or 2 minutes? Is this possible?



MySQL Restarting Every 8:30 Minutes
My MySQL service seems to be restarting itself in intervals of 8 minutes and 30 seconds. There is, at most, a variation of a second or two. I can't seem to find out what is causing it. There are no cron jobs that I can see, the error log is only showing the stopping / starting messages, and the mysqld log doesn't seem to be showing anything peculiar around the time of the restarts.

Select All Records Less Than 10 Minutes Old?
I'm wondering if anyone can tell me how to write an SQL statement that will select all records that are less than 10 minutes old, using a datetime column?

How To Do An Action In Mysql Every 15 Minutes
i want to get the values from a web and add it to my database. but i don't know how to call a process every 15 minutes and i don't know how to get the data from the web. The web data is stored on a table, i thin i can do something with it.

How To Select Records When No Activity For 20 Minutes
I have a problem, i have 31days, 24h loged activity (timestamp). If there was no recorded activity in the log for 20 minutes in this interval, i have to find when this happened (Record A, Record A+1).

Working Out The Number Of Minutes Between Two Dates
Using MySql 3 (deliberately using an old version) how can I work out the difference between a date in a database field (stored as a unix time) and now. I'm actually using PostNuke and want to identify how long open items have been in my phpbb forum.

I've tried various forms and the last effort was :
select  to_days(now())-to_days(from_unixtime(p.post_time)) from nuke_phpbb_posts p

but that gives my a lowest number of 176 (I know people have been using it today).

HELP: SELECT Only Last Last Few Records That Were Created Within Last 5 Minutes
I've got a transactions table with a tstamp field (datetime type) and
I need help creating a SELECT query to retrieve only last transactions
that occured within the last 5 minutes. The datetime type writes the
tstamp as YYYY-MM-DD HH-MM-SS and I am using mySQL 4.1.

Retieve Only The Difference In Minutes Between Two Dates
i am just lookin for a func or way about to retrieve the
difference in minutes between 2 dates which are of DATETIME data type
for induvidual records help in this regard is highly solicited.

Selecting Records From Database Entered Less Then 30 Minutes Ago?
I have tryed everything to select records from the database that have been entered less then 30 minutes ago. I have the time/date stored as a TIMESTAMP, so i need to find a way of returning the records.

Build An Automated PHP Gallery System In Minutes
Kia Ora From New Zealand

I get the following warning on both these tables

PRIMARY and INDEX keys should not both be set for column `category_id`

also I have built a script to add a new catorgory to the gallery but the only thing that happens is the Category_id increments is this becouse PRIMARY and INDEX keys should not both be set for column `category_id`

CREATE TABLE gallery_category (
category_id bigint(20) unsigned NOT NULL auto_increment,
category_name varchar(50) NOT NULL default &#390;',
PRIMARY KEY (category_id),
KEY category_id (category_id)
) TYPE=MyISAM;

CREATE TABLE gallery_photos (
photo_id bigint(20) unsigned NOT NULL auto_increment,
photo_filename varchar(25),
photo_caption text,
photo_category bigint(20) unsigned NOT NULL default &#390;',
PRIMARY KEY (photo_id),
KEY photo_id (photo_id)
) TYPE=MyISAM;

Calculating Time Difference In Minutes Between 2 Times
I have two columns in a table start_time and end_time (stored as datetime). I wish to work out the time difference in minutes between these two values. If the difference is 1hr 30 minutes I wish to get 90 (mins)

I have tried:

SELECT TIME_FORMAT(TIMEDIFF(start_time, end_time), '%i') FROM table ...  This returns justs the minutes (e.g. 30)

and

SELECT TIME_FORMAT(start_time - end_time, '%i') FROM table .... no such luck.

Find Days, Hours And Minutes Between 2 Dates
I have a datetime field in a mysql database and i want to output how many days, hours and minutes are left between the current date and the future date.

So far i just convert the datettime to a timestamp like so: $start = strtotime($began);

Where $began is the current time, basically i just need to know how to convert a timestamp to days, hours ect If i was to minus the current timestamp from the future timestamp.

How To Substract Minutes From A Time Field In Mysql Query?
I have a problem, i want to substract minutes from a time field in a mysql query, i'm trying with the next query:

UPDATE TblOrders SET TmHours = TmHours - '00:09:00';

In the query I want to substract 9 minutes from all time fields named TmHours in the table, the datatype for the field TmHours is time.

Function To Extract Difference In Minutes From DateTime Variables
I need to compare a datetime field in my database with the current time
and return only the records that are 5 minutes old or older. Is there
any way to do it? Any function to it?

I use to_days() when I am doing the same thing but with days instead of
minutes.

Selecting Date Time Field, Difference In Minutes
I wonder if is there any way to select from a table all the records
which has a Date Field that is at least five minutes old?

In other words, I have a table with a date field and I need to select
all the records that are older than five minutes, has their date field
updated before five minutes.

Usually I do it with days by using the to_days() function and comparing
the date to now: (to_dayss(now()) - to_days(somedate)).

Minutes + TIME = TIME Function
I need some way to convert minutes (e.g. 80 mins) to SQL TIME (e.g. 01:20:00) in order to add it to another TIME var.

Is there any way to do this? I really dont want to convert my whole db. Basically, I want to do: e.g. 80 + 10:00:00 = 11:20:00.


Copyright © 2005-08 www.BigResource.com, All rights reserved