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?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
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) ---------------------------------------------------------------------------------------------^
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.
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.
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.
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).
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 Ɔ', 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 Ɔ', 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.
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)).
Count Related Records, But Show Records With NO Related Records Also
cl_items ======== it_id (pk) it_ownerid it_name cl_offers ======== off_id (pk) off_itid (fk) -> to it_id off_whoid My query needs to output ALL of the records in cl_items AND still show how many offers are on each item (from cl_offers) I can't get what I want through the GROUP BY because I want to show the records in cl_items which DO NOT have any offers on them yet also. Is there any way to do this with mysql only?
All Records From Table A - All Records From Table B - Join Alike Records
I am by no means a SQl Jedi as will be apparent by my question, but I can usually figure out a select statement on my own. I have one today though that really has me stumped. I am working in MySQlL 5. In My first select statement I get all my records from Table B SELECT `table_A`.`ITEM`, `table_A`.`DECSCRIPTION`, `table_A`.`UM`, `table_A`.`PHASE`, `table_B`.`Qty`, `table_B`.`Calc` as calculated FROM `table_A` Inner Join `table_B` ON `req_itemlist`.`ITEM` = `table_B`.`ItemID` In my second statement I get my records that match in this case phase 401 in Table B and all my Table A records for phase 401. SELECT `table_A`.`ITEM`, `table_A`.`DECSCRIPTION`, `table_A`.`UM`, `table_A`.`PHASE`, `table_B`.`Qty`, `table_B`.`Calc` as calculated FROM `table_A` Left Outer Join `table_B` ON `req_itemlist`.`ITEM` = `table_B`.`ItemID` Where table_A.PHASE In ('401' ) Now I need to combine the Data of both recordsets. I need EVERYTHING in Table B, but I also need All Table A records that match the phase selection.... Can I write this one query or do I need to use a Temp table?
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.
Can't See Old Records
I really don't know much about mysql. We have an hardware device performing bandwidht management which we didn't even know it is using mysql until it was broken down. After we solved the problem, we saw that the operationg system running in the device is linux (and old version) and the database is mysql. The problem is that we can't see the old data eventhough when I view the binary ISD file I can see the whole data including the olds. But the management program doesn't show the old data. When I reenter new definitions from the management program, I can see that they are written into the ISD files. ISD files contains both old and new records but I can see the only new files. Does that mean the index files are curropted? If so, How can I recreate indexes or recover them?
Records That Are Only From 3 Pm To 6 Pm
I have a field in my table called time which is a datetime field. The format of the data is like these below: 2006-07-12 17:55:19 2006-07-11 16:31:34 ...... I would like to get every records that are only from 3 pm to 6 pm. Is there any query where I can check for the hour of a datetime field?
Top 5 Records - ASP
I have an ASP application talking to a MySQL database. All works fine but: 1) I can't figure out how to select just the latest 5 records in a table. 2) SELECT LAST_INSERT_ID() doesn't work, it just returns 0. 3) I need to select the 'recordid' (held in the first field and is the PK) of the latest record.
Getting Last 12 Records
I am trying to get just the last 12 records from a table. I have tried this but get no results. SELECT TITLE, ARTIST, STYLE, MEDIUM, FORMAT, CATEGORY, WIDTH, HEIGHT, SPRICE, FILENAME, NUM FROM PICTURES WHERE CUSNUM='YES' AND ARTALLOW<>'NO' ORDER BY DESC LIMIT 12
Get Records From The End
my question is how can I get the last 20 rows from a table without changing the order the table is.
Certain Records
Code: insert into users (username, password, email) select user , ID, email from selex.empleados_selex but i want to copy only the records where its status is "working" something like: insert into users (username, password, email) select user , ID, email from selex.empleados_selex WHERE status =´working`
Pf Records
Is it possible to specify the limit of records that can be entered in the table.
No Records In DB
I connected to the DB like this: Set rsP1000 = Server.CreateObject("ADODB.Recordset") strSQL = "SELECT [G2P] FROM tblClients WHERE ClientID = '" & strID & "' AND GTime2 ='10:00a'" rsP1000.Open strSQL, adoCon I was wondering if the connection does not return any results, how do I display nothing. It keeps failing out because there is no record.
Records
I have a mysql database running on Mysql version 3.23.53 on a Red Hat Linux 7.2. In the database there is a single table with over 150,000 records. Unfortunately, the performance of that table is very poor, comparing to other tables in the same database.
Get Records
I have one table (members) and a linked table (payments) and I trying to retrieve all the records in the members table that don't have a record in the payments table.The payments table is linked to the members table by memberId. Does anyone know how I would compare the two tables and bring back only the members that don't have a record in the payments table?
To Many Records
This query is getting me rows which dont = $cid can anyone tell me why? =x Code: "SELECT event.eventName, event.eventMonth, event.eventYear, exhibitor.standNum FROM event, exhibitor WHERE exhibitor.companyID = event.companyID AND exhibitor.companyID = '$cid'"
Records
I want to extract those values whose modificatio dates are few days older using the following sql [SQL] select status from note where mdate<=date_add(date('Y-m-d'),interval -2 day) and status='Selected' and id=$r[0]; [/SQL] but the comparison 'mdate<=date_add(date('Y-m-d'),interval -2 day)' doing nothing. I have checked it in db. There is no error too. How to correct that?
40 Records
This is to gather a sample from the database. I need to select 40 consecutive records every 1001st record. So I would need records 1001-1040 and records 2002-2041 and so on. Anyone have a clue on how to write the query for this?
Records 1 To 10, 10 To 20 Etc
im not sure how to do this or what to search for so any help would be great. basically if i do a (select * from table) how do i get only the fiorst ten matches like records 1 to 10 then like on another page id have records 10 to 20. i thought i coudld use limit but when i do say SELECT * FROM `sale` LIMIT 2 , 4 i get 4 results back instead of what i thought would have been results ows 2 to 4
10.000.000 Records
I've got some experience building PHP/MySQL websites, but the databases in these websites never contained more than a couple of thousand records. Now I've been asked to build a website with a database containing a table with roughly 10 million records.This amount of records gives me the creeps, to tell you the truth. It's simple records, containing just 2 columns. The only thing a script would have to do is check wether a code is in the database or not. Can I use standard PHP scripting methods and SQL queries, or does this amount of records demand a totally different approach? I can imagine an application getting very slow when it has to work with a huge recordset like this. What do I have to consider before I decide to build this site (or not)?
How To Get Subtotals Along With All Records?
I have a cart full of items. Each item belongs to a category - so, there might be 3 items in the cart belonging to Category A, 2 to Category B, etc. If possible I'd like to select all items from the cart, and at the same time get the subtotal for each category (so I can then say "$500 was spent on category A" and so forth). I am currently exploring the SUM/GROUP BY avenue, but I will admit I'm not at all sure of what I'm doing...
Counting Records
Got a question for you that is really stumping me. I have 3 tables job_jobs ------------ job_id job_name . . . job_cats ------------- cat_id cat_name . . . job_jobsToCats ------------- jtc_id job_id cat_id *************** ok i have those 3 tables to categorise the jobs on the site and im trying to build a query that will essentially get all categry names and display the number of jobs in that category so when i output it i will get accounting (12) admin(2) etc etc
Records That Don't Match
I have two tables. One has bar information. The second has the bar's drinks. They are tied by 'bar_id'. So there are either one or multiple records in table 'bar_drinks' for a given bar_id. The problem is finding the bars that don't exist in the bar_drinks table. I tried several ways, even a subselect, but get an error of more than one row existing: SELECT bar_name FROM bar WHERE bar_id = (select distinct bar_id from bar_drinks) I see the error here, but really am stumped how to achieve this....
How To Get Records Between Two Dates
In database I have stored dates in ��-00-00 00:00:00' format. And from user I am getting dates in 'mm/dd/yyyy' format. 1- How can I get records from database between user entered dates.
Records Being Removed
Can anyone tell me why records would keep being deleted on an mySQL database? I don't think the server is being hacked - but how could I make it more secure (it is Windows 2000)?
Deleting Records
I have the following table PHP +--------+-------+---------------------+ | postID | catID | date | +--------+-------+---------------------+ | 125 | 0 | 2006-08-18 17:02:40 | | 126 | 0 | 2006-08-18 17:03:02 | | 123 | 0 | 2006-08-18 17:03:13 | | 131 | 0 | 2006-08-25 12:34:20 | | 130 | 0 | 2006-08-25 12:34:49 | | 135 | 0 | 2006-08-28 15:14:13 | | 137 | 0 | 2006-08-28 18:23:27 | | 138 | 0 | 2006-08-28 15:43:15 | | 139 | 0 | 2006-08-29 00:17:42 | | 140 | 0 | 2006-08-29 12:01:43 | +--------+-------+---------------------+ What i'd want to do is to setup a daily script to delete records from this table but only leave out 8 latest records. Is there a single sql query to do the deletion?
Update 175,000 Records In 1 Hit
I have just under 175,000 records in my database and need to create an MD5 hash of a certain field in each row. I created a page to run on localhost which had the following PHP <?php mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("wordlist") or die(mysql_error()); if (isset($id)) { $id=$_GET['id']; } else { $id=Ƈ' } $GetThisWord_result = mysql_query(" SELECT * FROM word_list WHERE id=$id") or die(mysql_error()); $GetThisWord = mysql_query($GetThisWord_result); $GetThisWord = mysql_fetch_assoc($GetThisWord_result); $word=$GetThisWord['word']; if ($word=="") { header("Location: ./end.php"); } else { $query = "UPDATE word_list SET hash=MD5('$word') WHERE id='$id'"; mysql_query($query) or die(mysql_error()); $nextid=$id+1; header("Location: ./index.php?id=$nextid"); } ?> But the browser keeps coming up saying theres an error as the page will just keep repeating itself after it's processed 20 rows. Can I just enter PHP UPDATE word_list SET hash=MD5('$word') WHERE id='$id' or simiilar into MySQL Front and let it do it all itself?
Selecting Top Records
I was posed a question in an interview that required me to select the top 3 records of table after doing a sort. I have been studying MySQL for the last 6 months or so and don't recall that capability in MySQL. I know it is available in Oracle and SQL Server. Is this possible in MySQL?
Records Disappear
Has anyone experienced their records disappearing. I have 8 tables in a DB that each table rougly contain 10 to 900 records. the program that i had developed is a PHP program. I checked the site the other day and their was some data missing. i checked the DB and i noticed zero records in a few tables. the only thing that i can think of is in Cpanel(WHM) I exported the DB the day before for my weekley backups. I export all my DB in PHPmyadmin every week, just incase my server crashes. I have a dedicated server.
Duplicating Records...
I have looked long n hard at the Insert Select as being the answer to my need to create duplicate records. (Purpose is basically to allow someone to create a duplicate of an existing email template then modify it). I have tried all sorts of variations on: INSERT INTO emaillist SELECT * FROM emaillist WHERE emailid = #url.emailid# (inc trying IGNORE) but of course this throws an error over duplicate keys. All I want to do is to take Record A, duplicate it and have a new key assigned to it (the key is an autonumber field).
|