mysql

Is it more memory efficient to store images in mysql as BLOB or as plain files somewhere?

I have a LAMP server with 256MB RAM (poor man's server in cloud). I have an app written to run on this machine. Currently people upload images and they go straight into mysql as BLOB. There are concerns that this might be very memory consuming operation and we move over it to simple plain files. Can some one tell me if these concerns a...

MySQL Reg ex, need to match phrases in any order

I am using a MySQL Database to search through a list of categories. My query is: select * from cat where name REGEXP('(region_Long Island)+(.)*(sport_Outdoor Track)'); where the values "region_Long Island" and "sport_Outdoor Track" are passed in. I need to be able to match these categories, regardless of the order they are in. In the t...

Reading a composite key in mysql

I'm trying to generate a dynamic property in a framework I'm using, and I'm having some difficulty.. I have two tables joined in a many to many relationship (platforms, titles, and games) games has two primary keys, titleid and platformid select * from games where CONCAT(platformid,titleid) = 110 110 is just an example, but the record...

Combining two select queries

A the moment I am using two queries one is called initially, and the second is called during a loop through the results of the first. I want to combine both queries, but have been unable to so far. The tables the queries are pulling from are: +--------------+ +--------------+ +--------------------------+ | table_1 | | t...

how to move data

I have a table with data as following: id col1 col2 1 c1 1 c2 2 b1 3 a3 4 e1 4 e2 Now I need to move this data in another table in such a way that the record that has same id goes as a single record in this new table. so the new table data would look like this: id col1 col2 1 c1 ...

WCF service error when using MySql.Data.MySqlClient

I have a fully functional WCF webservice hosted in iis7 on Win Server 2008 machine. The problem is when I try to implement mysql calls to a method in the service. The method works fine when debugging in vs, all the mysql methods and the call to the database works as it should, but when deploying it to the server I get "The server enc...

Remove Duplicate Rows Leaving Oldest Row Only?

I have a table of data and there are many duplicate entries from user submissions. I want to delete all duplicates rows based on the field subscriberEmail, leaving only the original submission. In other words, I want to search for all duplicate emails, and delete those rows, leaving only the original. How can I do this without swappin...

Deadlock in queries.

Hi, I get this exception: Error Code : 1213 Deadlock found when trying to get lock; try restarting transaction I am running 3 delete statements and 1 update statement in a query window. When i run those queries it throws error code 1213 and deadlock exception. My mysql version is 5.0. Please share your views. Thanks. ...

Single database call vs multiple database calls Performance

What is the difference in performance of making a single database (MySql) call that retrieves 10 results versus making 10 single db calls to retrieve those results individually? If one is better than the other, is there a way I can go about to test the performance between the two? (I'm just curious because in the future if I have anot...

mysql INSERT into multiple tables with one statement

Is it possible to insert data into multiple tables in one statement? For example, I have two tables (live_products and products) they are the same, except live_products is highly transactional and I keep the record count low (delete once done), where as products holds all historical data, used for reports, etc. Currently, I'm doing two...

MYSQL Query for SUM and DISTINCT?

I have a database with the first five columns like this: ID NAME QUANTITY PRICE KIND 1 Dog 2 5 A 2 Cat 1 6 B 3 Dog 2 5 C 4 Bird 5 5 C (DOG QUANTITY and PRICE will always be the same) What I want to do to is to something like SELECT KIND, SUM(QUANTIT...

join on three tables? Error in phpMyAdmin

I'm trying to use a join on three tables query I found in another post (post #5 here). When I try to use this in the SQL tab of one of my tables in myPHPAdmin, it gives me an error: #1066 - Not unique table/alias: 'm' The exact query I'm trying to use is: select r.*,m.SkuAbbr, v.VoucherNbr from arrc_RedeemActivity r, arrc_Merchant m...

MySQL email templates.. Is it possible?

Not sure if it's possible but it's worth a shot.. I am trying to insert into a MySQL 'TEXT' field some text.. Some of the words within the text I want to change depending on other fields from some other tables in the MySQL database.. Something similar to a php email template where the 'Dear ${first_name}' can be changed depending on who ...

Is MySQL still a good choice for a free/open source database?

Until recently, I've used MySQL for all my database needs in all my server projects. However, after Oracle came along and bought MySQL, there seems to be some uncertainty about the future of MySQL. So I'm left wondering whether I should stick to MySQL (which I'm fairly familiar with), or should I switch to something like PostgreSQL. An...

MySQL Check if a database exists

I'm trying to determine if a database of a certain name exists and then create it if it does not. Ideally this would be in VBScript. I currently am trying using a loop search of an array but the total number of databases will change greatly. set dbQuery = ConnSQL.execute(checkDBsql) if dbQuery.BOF and dbQuery.EOF then ' Que...

MySQL or PHP date averages

Hey, I am trying to figure out how to find the average of a number of different time values, the time values are time differences from 2 dates so they will be in the format of "hh:mm:ss". So if I had 4 time values of: 00:11:05 00:01:30 00:04:25 00:09:50 I am having trouble figuring this out. I am thinking that these time values woul...

What directive is causing this?

Hello all, I have moved my site to a new server and I have noticed strings returned from the database that have quotes in them are automatically escaped with a backslash, so I have this appearing in my HTML out output \' where ever there is a quote - I am wondering what is causing this, a PHP directive? What directives in PHP or anythi...

only retrieving 1 row of data from MYSQL database

Hello, I am trying to input multiple pieces of data through a form and all the data will be separated by (,). I plan to use this data to find the corresponding id for further processing through an sql query. Below is the code I use. $key_code = explode(",", $keyword); //$key_count = count($key_code); $list = "'". implode("','", $ke...

Copy Magento Categories to Parents

Scenario: A new blank Magento with a category product and customer import with some fixes to do. Category structure: Root L..Category_parent1 (0 products) L..Category_child1 (22) L..Category_child2 (34) L..Category_parent2 (0) L..Category_child1 (22) L..Category_child2 (34) L..Category_parent3 (0) L..Category_chi...

I'm not getting the expected result from an SQL query.

I'm developing a search function for a website. I have a table called keywords with two fields id and keyword. I have two separate search queries for AND and OR. The problem is with the AND query. It is not returning the result that I expect. The printed SQL is : SELECT COUNT(DISTINCT tg_id) FROM tg_keywords WHERE tg_keyword='keywor...