mysql

Many slow yet non-existant mysql queries?

My Mysql slow query log shows many entries like this: # Time: 100104 16:32:14 # User@Host: root[root] @ localhost [] # Query_time: 2.929673 Lock_time: 0.000000 Rows_sent: 0 Rows_examined: 0 use mydatabase_production; SET timestamp=1262651534; COMMIT; ** Note the absence of any actual query! ** This began within the past day. It's ...

MySQL: Update_time not updated (Windows)

Hi! I have this intermittent problem with MySQL 5.1.33 (Community Server) for Windows, where the Update_time (when using SHOW TABLE STATUS) does not seem to get updated when executing UPDATE command. After connecting to MySQL, I executed "SHOW TABLE STATUS" command, and it returned Update_time: 2010-01-05 08:28:27 I then executed an ...

Concurrency Error updating a row a second time C#

HI I am getting the "Concurrency violation the updatecommand affected 0 of the expected 1 records." error while trying to update a row, weird thing is that I CAN update the row a single time and next time I repeat the process on the same row I get the error, I have already tryed the endinit and endedit thingys, any help would be apprecia...

Too Many Columns in MySQL - error 1117

I just added a new field to my table in mysql and it came back with a warning of "1117: too many columns" The table has (gasp) 1449 columns. I know, I know it's a ridiculous number of columns and we are in the process of refactoring the schema but I need to extend this architecture just a bit more. That said, this doesn't seem to be r...

Translating INTERSECT statement to MySQL

I have the following query using INTERSECT and I can't figure out how to translate it to MySQL using INNER JOIN. SELECT DISTINCT Title, Variable FROM Table WHERE Location='Location1' AND Date='Date1' INTERSECT SELECT DISTINCT Title, Variable FROM Table WHERE Location='Location2' AND Date='Date2' INTERSECT SELECT DISTINCT Title, ...

Order a mysql query alphabetically

Let's say that I have the following code: SELECT * FROM table where company LIKE '%Auto%' And I receive more results, and I want to have an option to sort the results alphabetically, let's say that the user wants to sort the search results for the ones which start with "C"! Best Regards, ...

MySQL divide two series by eachother

I have several data series in a MySQL table. The fields are Series, Date, Value. Is there a way for me to select, for two distinct Series, all the dates for which the series overlap and then for each date, the quotient of the value from series one and series two. Example: Series Date Value Dogs 2004 10 Dogs 2005 12 Dogs ...

Thumbs system on Urban Dictionary

I was thinking of implementing a thumbs system, but mine would require a registration thus ruling out the possibility of people voting more than once unless they create a new account to do so. So I was wondering about Urban Dictionary's thumb system. How does it work? I would imagine that my IP would be stored in a database, so people wo...

how to access mysql tables with jruby ?

basically i have a table full of data that needs to be processed. i need to somehow access mysql from jruby. which gem can I install on jruby ? where can i find some good tutorials on working with mysql and ruby ? I am not looking for ruby on rails.. ...

JQuery & PHP - How to display and get the average rate and votes casted?

I'm trying to display the average rate and how many votes have been casted but I really don't know how to do it. I need help on how to display something like this Rating. 4.83/5 (6725 vote cast) under the star rating? But I really don't know how to do this or what to add or change? Here is the JavaScript below. // JavaScript Documen...

Best way to write this query.

I have two MySql tables as shown below with the data shown: CREATE TABLE `A` ( `id` int(12) NOT NULL AUTO_INCREMENT, `status` varchar(50) DEFAULT NULL, `another_field` varchar(50) DEFAULT NULL ) INSERT INTO `A` VALUES ('1', null, 'a'); INSERT INTO `A` VALUES ('2', null, 'b'); INSERT INTO `A` VALUES ('3', null, 'c'); CREATE TABLE `B`...

insert query with a subquery

hi i tried to use the following query to insert data in a table nd got error insert into filmo_person_song (person_id, song_id, role_id) select person_id from filmo_person_song fps, filmo_song fs, filmo_role fr where fps.song_id = fs.song_id and fps.role_id = fr.role_id and fps.person_id = 43629; ERROR 1136 (21S01): Column count d...

mysql order by issue

if i have a query like : SELECT * FROM table WHERE id IN (3,6,1,8,9); this array of the ids is build in php dynamically , and the order is important to me. $my_array = array (3,6,1,8,9) ; how can i sort the results by the order by which the elements appear in my array ? its possible to do it in MYSQL query, or i must to order it...

mysql *server* protocol implementation for PHP

hello, there are already some applications available which "understand" the mysql protocol and to which it's possible to connect using a mysql client -- for example: you can connect to the sphinx search engine using the (an) mysql client, mysql-proxy understands the mysql-protocol, too. etc. now i wonder if there is an implementation a...

What's wrong with this code?

What's wrong with my code? I keep getting this error: Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in functions.php on line 4 error reading database function gameTableCheck($gn) { $result = mysql_query("SHOW TABLES LIKE '$gn'",$db) or die ('error reading database'); //This is line 4 if (mysql_n...

Converting MyISAM to InnoDB. Beneficial? Consequences?

We're running a social networking site that logs every member's action (including visiting other member's pages); this involves a lot of writes to the db. These actions are stored in a MyISAM table and since something is starting to tax the CPU, my first thought was that it's the table locking of MyISAM that is causing this stress on the...

formatting a date field in mysql

Hi all, I have a birthdate field stored in a table in the database.At present it displays the values as 2005-10-12 but i wanted to display as 10-12-2005.I have tried the following query but it doesnt display the field at all in PHP.Any suggestions will be helpful.By the way this query when executed directly on the database it is dispaly...

PHP mySQL - UNIX_TIMESTAMP is not equal to strtotime

Hi all, PLATFORM: PHP & mySQL I am storing the date+time in database in the following format: date("Y-m-d H:i:s"). An example of a value that I have in my DB is : 2010-01-05 07:36:33. In my script, I have set the timezone as date_default_timezone_set("America/Chicago"); THE PROBLEM: I read about the UNIX_TIMESTAMP somewhere and I w...

Cannot Use System While .Net Application Processes SQL Statements

Hey- I'm using a MySQL connector in VB .Net to execute a batch of SQL inserts. This is typically on the order of 5k statements and takes around 30 minutes to process. Unfortunately, when this process is running and I use a different application on the system, upon returning to the .net app it hangs and shows "not responding". In fact...

Getting 5level relation with one mysql query

Hi folks.Thank u a lot for your answers beforehand. I need to make a such thing I have a table friendship (id,user_id,friend_id,status,timestamp) So lets say I am a user with user_id=43 and I am visiting a user with user_id=15 In the profile it should be a connection line of friendships Let me describe ... lets say I have...