hi how can i use more than one 'between' clause in mysql query ? like if i want to select students having height between 20 and 25 and weight between 50 and 70..
thanks in advance
tismon
I have got a simple MySQL table and primary index (id) is not numbered one by one (1, 31, 35, 100 etc.). I want them to be numbered like (1, 2, 3, 4). Please tell me how to do it. I would also like to point that I am aware of possible consequences of the operation, but I just want to tidy up the table.
Hey,
I'm doing a statistical research application. I need to store words according to 2 initial letters which is 676 combinations and each word has its number of occurrences (minimal, maximal, average) in text. I'm not sure how the model/schema should look like. There will be a lot of checking whether the keyword was already persisted. I appreciate your suggestions.
Edit: I'll be using either mysql or postgresql + spring templates
Hi, when trying to create a simple procedure in mysql 5.1.47-community it fails everytime i've tried everything!
even simple things like this!
DELIMITER //
CREATE PROCEDURE two ()
begin
SELECT 1+1;
end;
//
hi
my users upload photo and all uploads recorded in mysql with the date info. i want to limit uploads by the months. user may just upload 3 pics in a month. what is the best way to do this ?
cheers
I am making some updates to a php site which I did not design. I have a local copy of the site. At the top of each page there are settings for the host name for the db connection.
Is there someway I can setup a pointer to the remote address. The address is 'mysqlhost' for example and I want that to point to 'mysql.myhost.com'. I tried creating a HOST record for mysqlhost pointing to the IP address it resolves to but that doesn't work.
If I put 'mysql.myhost.com' in the connection it works. If I put that IP address it doesn't so that is probably why the HOST record idea doesn't work.
Other than creating a local copy of the DB is there a quick way so that I don't have to modify each file in my dev environment and then again when I redeploy?
I'm creating a page that's a search result...
When you're viewing one of the results, at the bottom of the page, I need to insert "Next result" and "Previous result" links, like a pagination... But from [I think] a saved search, right?
How you people would do this?
Obs.: I'll use CakePHP (PHP) and MySQL
I'm running a LAMP stack. When I go into phpmyadmin, I can see that there are quite a number of sleeping connections which probably should be closed. Is there a way, using either Apache or MySQL, to determine on which pages those connections are created?
I have install apache,php and mysql on Mac 10.8.1.
After this, in my web brower i type this, it give the error message
Not Found
The requested URL /News-2012-Academy-Awards-53.html was not found on this server.
Apache/2.2.22 (Unix) mod_fastcgi/2.4.6 mod_ssl/2.2.22 OpenSSL/0.9.8r DAV/2 PHP/5.3.13 with Suhosin-Patch mod_wsgi/3.3 Python/2.7.2 Server at clontarf.girlsacademy.com.au Port 80"
Please help me to solve it.
I'm getting average prices by week on 7 million rows, it's taking around 30 seconds to get the job done.
This is the simple query:
SELECT AVG(price) as price, yearWEEK(FROM_UNIXTIME(timelog)) as week from pricehistory where timelog > $range and product_id = $id GROUP BY week
The only week that actually gets data changed and is worth averaging every time is always the last one, so this calculation for the whole period is a waste of resources. I just wanted to know if mysql has a tool to help out on this.
When you run something similar to:
UPDATE table SET datetime = NOW();
on a table with 1 000 000 000 records and the query takes 10 seconds to run, will all the rows have the exact same time (minutes and seconds) or will they have different times? In other words, will the time be when the query started or when each row is updated?
I'm running MySQL, but I'm thinking this applies to all dbs.
What is the upper limit of records for MySQL database table. I'm wondering about autoincrement field. What would happen if I add milions of records? How to handle this kind of situations?
Thx!
In some languages (ColdFusion comes to mind), you can run a query on the result set from a previous query. Is it possible to do something like that in php (with MySQL as the database)?
I sort of want to do:
$rs1 = do_query( "SELECT * FROM animals WHERE type = 'fish'" );
$rs2 = do_query( "SELECT * FROM rs1 WHERE name = 'trout'" );
I have a scenario where I'm calculating something in the WHERE clause of my SQL, but I also want to get that calculation - since it's expensive. Is it possible to get the results of something done in the WHERE clause, like this:
SELECT `foo` FROM `table` WHERE (foo = LongCalculation())
Wishful thinking, or possible with MySQL?
Hi,
I have the following MySQL tables:
TABLE: Products
----------------------
id | productname
1030 | xBox 360
1031 | PlayStation 3
1032 | iPod Touche
TABLE: Sales
----------------------
productid | saledate
1031 | 2010-06-14 06:30:12
1031 | 2010-06-14 08:54:38
1030 | 2010-06-14 08:58:10
1032 | 2010-06-14 10:12:47
I want to fetch using php the products i sold today and groupe them by sales number and order by sale date (if possible) , example of Output:
Today's statistics:
-Playstation 3 (2 sales)
-Xbox 360 (1 sale)
-iPod Touche (1 sale)
Thanks
I am doing a mysql database search and retrieving some results via ajax livesearch using the example on w3schools and i want to manipulate those results (drag and drop them) but im having a problem because the script loads before you enter the search and get the results so it does absolutely nothing no the search results. Any thoughts on this matter ?
HI
friends, i wish to store image and resume of user in the data base.
i am using mysql data base and php5. i want to know that which field i set means data type.and how i set the range (maximum size) for uploaded data.
My team member not supporting to use Crystal report in asp.net web application. specially Crystal report with mysql database. Is there any other report available?
When i dump a table with uppercase letters using mysqldump it comes out as lower case in my dump.sql file. I found a report here in 2006, almost 4 years old http://bugs.mysql.com/bug.php?id=19967
A solution here suggest making linux insensitive. I rather not if possible. Whats the easiest way to copy a win32 db into linux?
UPDATE files
SET filepath = REPLACE(filepath, `sites/somedomain.com/files/`, `sites/someotherdomain.com/files/`);
I have a table called files with a field called filepath. MySQL returns this error: Unknown column 'sites/somedomain.com/files/' in 'field list'
How can i fetch all data from any table of a test DB and DUMP it on the production db in same tablename(structure)? in Mysql using PHP code?
Please help me..
I have a sql file generated by "mysqldump --all-databases" . There are many databases in it. What I want to do is to update my local database but only a specific one, not all. I tried to use "mysql -database=db_name < file.sql" but it updated all databases. Is there a way to skip all databases except the one that I want.