mysql

adding 30 minutes to datetime php/mysql

I have a datetime field (endTime) in mysql. I use gmdate() to populate this endTime field. The value stored is something like 2009-09-17 04:10:48. I want to add 30 minutes to this endtime and compare it with current time. ie) the user is allowed to do a certain task only 30 minutes within his endTime. After 30 minutes of his endTime, ...

MYSQL Fulltext search and LIKE

Hi, I am working with mysql full text search but find it lacking in situations where your string is part of a word within a field. If my filed is New York Times and I search for 'Time' I get no results. The hackish way to solve this is to set up two queries, one that does a full text search and the other than does SELECT * FROM ___ WHE...

How can I speed up a count(*) which is already using indexes? (MyISAM)

I have a 3 large tables (10k, 10k, and 100M rows) and am trying to do a simple count on a join of them, where all the joined columns are indexed. Why does the COUNT(*) take so long, and how can I speed it up (without triggers and a running summary)? mysql> describe SELECT COUNT(*) FROM `metaward_alias` INNER JOIN `metaward_achiever` ON ...

Restoring from backup and binary

There are times when a table / database is dropped unintentionally. I have to check the date-time of the start position from the binary when the backup was taken. I do also have to check the date-time of the position where the "drop" statement is found. I do run the mysqlbinlog statement with those parameters. I can not use start-posit...

MySQL: Selecting data from MS SQL Server

How do I select data from a MS SQL Server from MySQL? We have a system of linked server in SQL Server. I have also heard that you can do a linked server to Mysql from sql server. But I want to know the reverse. The mssql server is what we use mainly for production. So one main reason we'd want to do this is simply to get the exact mssql...

Is there a fast way to update many records in SQL?

I need to replace more than 20 000 names with new names i created given the CodeID. For example: I must update all rows that contain "dog" (which has a CodeID of 1) with "cat", and update all rows that contain "horse" (which has a CodeID of 2) with "bird", etc. 1st SQL statement: UPDATE animalTable SET cDescription = "cat" WHERE Code...

Error during installing dump.

I have the following dump: CREATE TABLE `testdata`.`carer` ( `ID` bigint(20) NOT NULL auto_increment, `IS_DELETED` bit(1) default NULL, `name` varchar(255) default NULL, `account_id` bigint(20) NOT NULL, `patient_carer_id` bigint(20) NOT NULL, PRIMARY KEY (`ID`), KEY `FK5A0E781D4C45C51` (`patient_carer_id`), KEY `FK5A0...

MySQL statement: spliting rows values into new columns

Using MySQL I need to return new first/last name columns for each user in table1. **Table1** uid 1 2 **Table2** id fid uid field_value 1 1 1 Joe 2 2 1 Blow 3 1 2 Joe 4 2 2 Blogs **Result** uid first_name last_name 1 Joe Blow 2 Joe Blogs ...

How can I handle an exception in DataSet.Designer.cs?

Hi all, I'm using Visual Studio 2008 along with C# to access a MySql database. To this point I have relied on Visual Studio to create the code for the DataSet, and that seems to have given me a problem. If the database is inaccessible (i.e. not running) it gives a "MySqlException was unhandled", "unable to connect to any of the specifie...

Removed MAMP from OS X, dyld still using MAMP libraries

When I try and use a populator or sphinx on a Ruby app I keep receiving dyld errors. I used to use MAMP on OS X Leopard but since I've upgraded to Snow Leopard and am now using standalone MySQL (10.5 64-bit). $ rake ts:index Would return dyld: Library not loaded: /Applications/MAMP/Library/lib/mysql/libmysqlclient.15.dylib Referenc...

What does Coercibility mean? MySQL User Variables

All user variables have an implicit coercibility value what does that mean? does that have something to do with ... mysql> SET @a = 1; mysql> SET @A = @a; mysql> SELECT @a, @A; mysql> SELECT @a, @A; +------+------+ | @a | @A | +------+------+ | 1 | 1 | +------+------+ mysql> SET @a = 2; mysql> SELECT @a, @A; mysql> SELECT @...

ASP.Net / MySQL : Translating content into several languages

I have an ASP.Net website which uses a MySQL database for the back end. The website is an English e-commerce system, and we are looking at the possibility of translating it into about five other languages (French, Spanish etc). We will be getting human translators to perform the translation - we've looked at automated services but these ...

MySQL statement using OUTER JOIN vs using WHERE to set conditions...

For the statements with INNER JOIN: SELECT column(s) FROM table1 INNER JOIN table2 ON condition(s) ... INNER JOIN tableN ON condition(s); I can write an equivalent statement with this: SELECT column(s) FROM table1, table2, ..., tableN WHERE condition(s); notice how I use WHERE to set my conditions in the second statement. Question...

[mysql] Auto Update query

Hello, I wanted to know whether i can direct update mysql datas to add (+) the values, without needing to fetch them. For example: My database is like this, data1 = 56 so to add a 4 to it, i will first fetch the data from the database then, $data1 = $data1 + 4; and finally again perform a Update query. So is there is way i can send l...

What is Error#1221 in Mysql and is basic problem in this SqlQuery?

I am using MYSQL5.1,Though I tried to find documentation for this but was unsuccessful,secondly I wanted to know logical error in the following query.. SQL QUERY SELECT date , month , Sum(fact_1) , ( 2 / Sum(fact_2) ) , 2 FROM( SELECT time.date, time.month, time.year, MAX(sales_fact.sell_out_value) as fact_1, 0 as fact_2 ...

rank over in mysql

I read this article, and i have the code in oracle, but I want to convert it to work on MySQL. In Oracle, i use the function rank, with four columns can eligible or not, how i can use this in mysql, or, it is not possible? This is the code, I want select the most eligible line, every line can have 4 columns completed, I want to rank on...

mysql counts in a group by

Say I have a voting table, where users can vote on values up, down, or flat. Say a user gets a point each time the corrcet projection is made. At the end of each week I want to display some statistics. Something like: SELECT user_id, sum( user_points ) as sum_points FROM voting_results WHERE voting_date > ('2009-09-18' - INTERVAL 1 WE...

Rightmost occurrence string match in MySQL

I would like to extract the file extension from a field in MySQL that contains filenames. This means I need to find the final '.' character in the field and extract everything after that. The following code example partially works: SELECT LCASE(RIGHT(filename, LENGTH(filename) - LOCATE('.', filename))) FROM mytable; except that it f...

Create View in Constructor class is right way

i m creating a view of a database in php smarty, i m confused where shoud i create that view , i just create view in a class's constructor function, now i have the problem that i m using function of that class through object of that class.... so is it true that each time that view is constructed??? example: cityview.php class city { ...

How can I get a Windows batch or Perl script to run when a file is added to a directory?

I am trying to write a script that will parse a local file and upload its contents to a MySQL database. Right now, I am thinking that a batch script that runs a Perl script would work, but am not sure if this is the best method of accomplishing this. In addition, I would like this script to run immediately when the data file is added to...