mysql

obtain data from mysql comma seperated

Hi, I have a column in my table 'refer'(column) 'chart1'(table) with values 49,47,50 so on for each person Now I have to take these numbers and get details of users with 49,47,50 in other table 'users' users(table) Name id address xxx 49 bnm yyy 47 kjh zzz 50 jhg chart1(table) Name refer accounts aaa 49,50 ...

Basic MySQL question: how to get rows from one table that are not in another table?

I have a list of usernames (with a column called "username") + other info in my "users" table. I also have another list of usernames (with a column called "username") in my smaller "recentusers" table. How can I create a mysql query to get all the usernames that are in the "users" table but not in the "recentusers" table? I know it is...

Mysql Foreach Child show Max() and Min() in a single line.

Is it possible to use a select statement so that it returns Max and min columns of a child row foreach Parent record? So foreach parent record that has MANY child records I want to see the Max and Min of those child records for any given column. How can I do this within a single select statement? It should read something like: Return ...

How to embed a quicktime video from a MySQL Blob

Hi, I am currently pulling out images from a MySQL Blob using code as follows: <img src="data:<?php echo $type; ?>;base64,<?php echo base64_encode($file); ?>" width="240"/> I am now trying to embed a movie in a page and I am currently using code as follows: <object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http:/...

SQL server express backend for ASP.NET web service.

I come from a linux/apache/php/mysql background. For my current project, I am forced to write web services using ASP.NET. I have installed visual studio and created an ASP.NET web service project. The web service I'm creating will use a SQL database backend. I see that visual studio installed "SQL Server Express 2008." I can see that the...

Converting from myisam to innodb

I am looking to convert my myisam mysql database to an innodb. I seem to keep coming up with conflicting ideas on how to do this or even if I should! What are your thoughts? ...

Help on an SQL query

I have a table named activity with 2 columns: when as datetime // last time i saw a user guid as varchar // a unique identifier for each user This tables is used to track usage in a certain resource. Guid are created by the clients. I want to be able to query how many new users I have in the last day/week/month. A new user is identi...

In PHP with PDO, how to check the final SQL parametrized query?

Hello, In PHP, when accessing MySQL database with PDO with parametrized query, how can you check the final query (after having replaced all tokens)? Is there a way to check what gets really executed by the database? ...

Homemade cheap and cheerful clustering with MySQL+EC2?

I've got a Java web service backed by MySQL + EC2 + EBS. For data integrity I've looked into DRBD, MySQL cluster etc. but wonder if there isn't a simpler solution. I don't need high availability (can handle downtime) There are only a few operations whose data I need to preserve -- creating an account, changing password, purchase receipt...

Is it possible to create mutiple MySQL queries within the same table?

Is it possible to make multiple queries at once within the same query? Here is an example of what I'm trying to do. We have the following table: | userid | price | stock | description | ---------------------------------------- 1 10.00 5 some text 2 25.00 2 some text 3 15.00 3 some ...

Joomla Cant Connect to DB

This sounds really easy to fix but I've been working on it for awhile. Database Error: Unable to connect to the database:Could not connect to MySQL I had to make a local copy of Joomla for backup and changes so I didn't mess up the live site. I grabbed all the files off the live site via FTP. Did a DB dump. Put the DB on my local m...

PHP PDO prepared statement -- mysql LIKE query

Hello All, This is my first post to stack Overflow, but I find the existing body of knowledge very helpful. At any rate, here's my issue: I am trying to do a search through php's PDO class (mysql driver). I have the following query working with the mysql client (table names changed to protect the innocent): SELECT hs.hs_pk, ...

How do I fix the 'Out of range value adjusted for column' error?

Hello, I went into phpMyAdmin and changed the value for an integer(15)field to a 10-digit number, so everything should work fine. I entered the value '4085628851' and I am receiving the following error: Warning: #1264 Out of range value adjusted for column 'phone' at row 1 It then changes the value to '2147483647'. After some g...

Find rows that have the same value on a column in MySQL

In a [member] table, some rows have the same value for the email columns. login_id | email john [email protected] peter [email protected] johnny [email protected] ... Some people used different login_id but the same email address, no unique constraint was set on this column. Now I need to find these rows and see if they should be ...

Can MySQL create new partitions from the event scheduler

I'm having a table looking something like this: CREATE TABLE `Calls` ( `calendar_id` int(11) NOT NULL, `db_date` timestamp NOT NULL, `cgn` varchar(32) DEFAULT NULL, `cpn` varchar(32) DEFAULT NULL, PRIMARY KEY (`calendar_id`), KEY `db_date_idx` (`db_date`) ) PARTITION BY RANGE (calendar_id)( PARTITION p20091024 VALUES LE...

Very slow mysql

Hi guy, I have a big problem with my server mysql. All worked fine but since on week, it is very slow. Each query is slow (more 20 secondes some times). I have changed nothing in my configuration. Someone can help me to know why my server is now slow ? Thanks. Here is my my.cnf: [ mysqld_safe] socket = /var/run/mysqld/mysqld...

mysql slow on first query, then fast for related queries

I have been struggling with a problem that only happens when the database has been idle for a period of time for the data queried. The first query will be extremely slow, on the order of 30 seconds and then related queries will be fast like 0.1 seconds. I am assuming this is related to caching, but I have been unable to find the cause ...

Is there a way to transfer info from one database into another database?

I was wondering today if it was possible to transfer data from one database to another with one query. Say I have two tables: CREATE TABLE `Table_One` ( `ID` int(11) NOT NULL auto_increment, `Type_ID` int(11) NOT NULL, `Title` varchar(255) NOT NULL, `Date` varchar(100) NOT NULL, `Address` varchar(100) NOT NULL, `Town` varch...

Setting auto increment lower than the current highest value?

I have a MySQL table with an auto-increment ID field. I'm filling the table with data from one source, with its own unique ID (starting from around 4 million up). I also want to insert my own data but don't want it to conflict with the IDs already in the database. Ideally I'd just insert it all at a lower ID. However, I have to use a fu...

PHP sleep() inside loop not updating DB

Hello, I have a php file that is fired by a cronjob every minute. When the php file is fired it updates the database, sleeps, etc It is programmed like this: $start = microtime(true); set_time_limit(10); for($i=0;$i<5;$i++) { updateDB(); time_sleep_until($start + $i + 1); } If this piece of code is run i don't see any chan...