mysql

MySql query taking too long - django on webfaction

I use django on webfaction, and I've got a "MySql query taking too long" message, the sql is SELECT (1) AS `a` FROM `main_userprofile` WHERE `main_userprofile`.`id` = 98 This is a rather simple sql, why the query taken too long? here it is the 'create table': main_userprofile | CREATE TABLE `main_userprofile` ( `id` int(11) NOT...

Is there a way to subtract an amount of days from a date in SQL?

I know about DATEDIFF(d, date1, date2), but I am not looking to subtract two dates, rather an amount of days from a date. For example: "2010-04-13" - 4 = "2010-04-09" Is that possible with mySQL? ...

Strange problem with MySQL full text query

This probably has something to do with my understanding of full text search or perhaps a known issue. My Java code creates search term for full text search on MySQL like this - +word* This works fine if the value in the DB column contains more text than the word itself. However, if the value is exact - no result are returned. I expec...

Problem of accent between MySQL and Java application

Hello, i have an application with use Hibernate and Mysql. In Mysql i have a blob in my table. When i record a value in this table with accent like é or è in mysql i have a good result (binary) so when i want read into my jsp i have ? instead of é ...

MySQL - remove HTML tags from record

Need help to form the MYSQL query from table one column having the bellow content Row1 : this is first <a href='mytext.txt'>row</a> from the table Row 2 : THis is the second row <img src ='mytext.jpg'> my image is there Row 3 : <p>This is the Third row my mytext is there </p> Row 4 : <p class='te_mytext'>This is the Third row my ...

Lightweight multi os monitoring plateform

Hi, I have a project where the is windows, freebsd and linux servers. I have to monitor some services : mysql replication status www status status with regexp on a webpage space on disk Is there open source software to do this and rapid to deploy ? Thanks in advance Best regards ...

MySQL function: Rotate old entries to archive table

Hi, I'm looking for the function that will take rows older then X days and put it in archive table... Was thinking to make function so it will be easer to execute... something like CREATE TABLE archive_NUMBER_OF_WEEK (...); INSERT INTO archive_NUMBER_OF_WEEK SELECT * FROM content WHERE DATE < X days; DELETE * FROM content WHERE DATE < ...

PHP: Array of objects is empty when I come to retrieve one from the array

Good morning, I am trying to load rows from a database and then create objects from them and add these objects to a private array. Here are my classes: <?php include("databaseconnect.php"); class stationItem { private $code = ''; private $description = ''; public function setCode($code ){ $this->code = $code; ...

How to get number of rows deleted from mysql in shell script

Hi all I can't work out how to get the mysql client to return the number of rows deleted to the shell when running a delete. Does anyone know what option will enable this? Or ways around it? Here's what i'm trying, but i get no output: #!/bin/bash deleted=`mysql mydb -e "delete from mytable where insertedtime < '2010-04-01 00:00:00'"|...

Move million records from MEMORY table to MYISAM table.

Hi, I am looking for a fast way to move records from a MEMORY table to MYISAM table. MEMORY table has around 0.5 million records. Both tables have exactly the same structure (same number of columns, data types etc.). But the MYISAM table is indexed (B-TREE) on a few columns. There are around 25 columns most of which are unsigned intege...

In Django, how to create tables from an SQL file when syncdb is run

Hi, How do I make syncdb execute SQL queries (for table creation) defined by me, rather then generating tables automatically. I'm looking for this solution as some particular models in my app represent SQL-table-views for a legacy-database table. So, I've created their SQL-views in my django-DB like this: CREATE VIEW legacy_series AS S...

Connecting to an existing database in Netbeans

I'm working in NetBeans 6.8 and I'm trying to create new connection using MySQL to an existing database. Does the .mdb file need to be in a specific location? It tells me that it cannot establish the connection. ...

login system with mySql database

I am using ASP.NET C# with mySql database. What is the best way for implementation of login system like Membership and Role. Membership and Role dont work with mySql database. ...

SQL Query about blob length

Is there a way to query a MySQL database that gives me all blobs that are bigger than 1kb? ...

SQL: Gather right hand values from a join

Let's say a question has many tags, via a join table called taggings. I do a join thus: SELECT DISTINCT `questions`.id FROM `questions` LEFT OUTER JOIN `taggings` ON `taggings`.taggable_id = `questions`.id LEFT OUTER JOIN `tags` ON `tags`.id = `taggings`.tag_id I want to order the results according to a particular tag nam...

How can we re-use the deleted id from any MySQL-DB table?

How can we re-use the deleted id from any MySQL-DB table? If I want to rollback the deleted ID , can we do it anyhow? ...

PHP/SQL/Wordpress: Group a user list by alphabet

I want to create a (fairly big) Wordpress user index with the users categorized alphabetically, like this: A Amy Adam B Bernard Bianca and so on. I've created a custom Wordpress query which works fine for this, except for one problem: It also displays "empty" letters, letters where there aren't any users whose name begins wi...

Odbc INSERT not working

Hey, im trying to get an INSERT command to work, but I keep getting the following error. Error: System.Data.Odbc.OdbcException: ERROR [42000] [MySQL][ODBC 5.1 Driver][mysqld-5.0.90-community]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INSET INT...

Can not insert UTF8 to Database MySQL in Linux

When create table, I have setted charset = utf8. I create 1 store procedure to insert data to database. When insert data UTF8 to Database on Window, it works OK.(Display data correctly) But it doesnot work in Linux.(Display data not correctly) The strange thing is insert UTF8 work fine in window, but when i deploy MySQL in linux, wh...

how to delete duplicates on mysql table?

hello I need to know any way to delete duplicated items for specified sid on table. how can I do this with SQL queries ? DELETE (DUPLICATED TITLES) FROM table WHERE SID = "1" something like this but i don't know true one :/ thanks. ...