So firstly here's my query: (NOTE:I know SELECT * is bad practice I just switched it in to make the query more readable)
SELECT pcln_cities.*,COUNT(pcln_hotels.cityid) AS hotelcount
FROM pcln_cities
LEFT OUTER JOIN pcln_hotels ON pcln_hotels.cityid=pcln_cities.cityid
WHERE pcln_cities.state_name='California' GROUP BY pcln_cities.c...
I want to do something like this
INSERT INTO t (t.a, t.b, t.c)
VALUES ('key1','key2','value')
ON DUPLICATE KEY UPDATE
t.c = 'value';
INSERT INTO t (t.a, t.b, t.c)
VALUES ('key1','key3','value2')
ON DUPLICATE KEY UPDATE
t.c = 'value2';
t.a and t.b are keys. This all works fine but i get an error on the second insert. With phpMyA...
Hi I have read many forums and websites that tell you how to upload an image to a server and I have managed to get this working, I can upload a file to a my server but storing the file name does work on the following example I found and I also need to create a form that allows more data to be entered to the database. I am stuck with this...
I would like mod_rewrite in an .htaccess file to link to a mysql database to provide me with mapping information.
Specifically, I am using a single code base to host multiple sites so..if a user requests an image, for example:
http://www.example.com/images/car.jpg
this is going to hit my server and many other sites will also be hitting...
I'm new to MySQL and I'm figuring out the best way to perform an on-line hot logical backup using mysqldump. This page suggests this command line:
mysqldump --single-transaction --flush-logs --master-data=2
--all-databases > backup_sunday_1_PM.sql
but... if you read the documentation carefully you find that:
While a --s...
Hello everyone.
So I'm trying to migrate a MySQL-based app over to MS Sql Server 2005 (not by choice, but that's life).
In the original app, we used almost entirely ANSI-SQL compliant statements, with one significant exception -- we used MySQL's group_concat function fairly frequently.
group_concat, by the way, does this: given a tabl...
How to increase the performance for mysql database because I have my website hosted in shared server and they have suspended my account because of "too many queries"
the stuff asked "index" or "cache" or trim my database
I don't know what does "index" and cache mean and how to do it on php
thanks
...
Looking for a nifty helper function/method for grepping through all defined tables, columns, stored procedures, etc, for a MySql database.
I had something similar for SQL Server.
...
I have been trying to find out if it is possible to do table
partitioning with disk based tables in MySQL Cluster. I want to store a
large table on disk, and do range partitioning on the table. I have a
feeling the answer is no.
Thanks for any info you can offer.
Mike.
...
(NOTE: This question is not about escaping queries, it's about escaping results)
I'm using GROUP_CONCAT to combine multiple rows into a comma delimited list. For example, assume I have the two (example) tables:
CREATE TABLE IF NOT EXISTS `Comment` (
`id` int(11) unsigned NOT NULL auto_increment,
`post_id` int(11) unsigned NOT NULL,
`na...
I have a simple table of events:
event_id | start_time | end_time
How do I query the maximum number of simultaneous events?
...
I have being trying since last night. At first it was working but this morning again its not working. I am installing mysql version 5.0 on vista machine. when i try to configure its says that:
The security settings could not be applied to the database because the connnection had failed with the following error:
Error Nr. 1045
access deni...
I get out of memory exception in my application, when the condition for IN or NOT IN is very large. I would like to know what is the limitation for that.
...
Hi,
I have a bit of PHP code which I need to return an even number of results from a MySQL database. I'm using the mysqli extension to execute my query.
My code is approximately this at the moment:
//assume we already have a database connection
$query = "SELECT id
FROM movies
WHERE publish = 1
AN...
Hello! I have a question about tables in MySQL.
I'm currently making a website where I have files for people to download. Now I want to make a table in MySQL that will store the latest downloads, like if someone downloads file1.zip then it will add a row in the table with the filename and date, so that I can show on the front page "Most...
Background: I want to use the Delphi translation of mysql.c in a project but the original maintainer Matthias Fichtner (http://www.fichtner.net/delphi/mysql/) appears to have taken it down.
Question: Does anyone know of a similar wrapper (or an updated version of Matthias Fichtner's wrapper) around libmySQL.dll that is similar in lightw...
Assume a table that uses a natural key and has a number of existing rows. What would be the easiest way to retrofit a surrogate key column and populate it with unique values using MySql?
I.e. transform
table employees
(
social_security_no varchar(20),
...
constraint emp_pk primary key (social_security_no)
);
to
table emp...
I'm writing some db utility scripts, and one of the tasks I need to do is rebuild the data only, but leave the schema intact. What is the easiest way to automate this from the command-line using bash and the mysql tools (no php, etc)?
Update:
I'd like the solution to handle all tables in one command, and if possible, not need to be upda...
I received a MySQL data dump and am trying to insert the data into a set of temporary tables. The creation statement for the first table is shown below. When I run this I receive the error: "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 ''temp_books'(...
I have read many times that MySQL will perform table level locks on MyISAM tables during inserts. It's OK with me if that lock is ment for serializing insert/delete commands only. Inserts are very infrequent on my website any way.
But will that lock block all Select queries too until the insert command finishes?
...