Questions tagged [mysql-5.1]

MySQL version 5.1 - please also tag with mysql for search purposes.

First released on Dec 01, 2008, MySQL 5.1 introduces the following features

301 questions
61
votes
6 answers

Why use WHERE 1 or WHERE 1=1?

Usually, if conditions are not required in our query statements, we don't use a WHERE clause. But I've seen a WHERE 1 clause being used in many places, even where other conditions are not present. Why is this done? Are there specific benefits to…
ursitesion
  • 2,071
  • 7
  • 32
  • 45
15
votes
4 answers

Can I make sure two columns dont have the same value

If I have a table that looks like this CREATE TABLE foo ( id INT NOT NULL AUTO_INCREMENT, aa INT NOT NULL, bb INT NOT NULL, PRIMARY KEY (id), UNIQUE KEY (aa, bb), CONSTRAINT aa_ref FOREIGN KEY (aa) REFERENCES bar (id), …
Nifle
  • 1,472
  • 7
  • 17
  • 30
6
votes
2 answers

MySQL ERROR 1137 (HY000) at line 9: Can't reopen table: 'temp_table'

I'm receiving an error ERROR 1137 (HY000) at line 9: Can't reopen table: 'temp_table' when executing a query similar to the following: USE database_name; CREATE TEMPORARY TABLE temp_table (status varchar(20)); INSERT INTO temp_table (status) …
Sean Airey
  • 235
  • 1
  • 2
  • 6
5
votes
1 answer

Merge difference MySQL DBs into a single new server

I have 4 servers which has it's own MySQL server along with databases and users. Now we have a new server dedicated only for MySQL and we would like to merge those MySQL servers into this new one. What is the most efficient way to move those MySQL…
Bonn
  • 53
  • 4
1
vote
0 answers

Convert a list into one row with dynamic column in MySQL

I have a list of row to be converted into a dynamic column that depends on the record in one particular column. From this statement FID |Steps | Action ---- |------|-------- 1416 | 1 | Sit 1416 | 2 | Run 1416 | 3 | Jump 1416 | 4 …
1
vote
0 answers

Merge/combine two queries with different dates

I have one query that runs a SUM statement based on daterange 1, and worked fine, and another query that run same SUM statement, but on a different date range. I would like to merge/combine the two queries in one but I don't know how. This is my…
gmgiordano
  • 11
  • 1
1
vote
0 answers

MySQL: Sometimes query failed to use index

I have a complex query including join of 4-5 tables. 1 months back, I have optimized this query and it was using the index. Also, two months back, index of all tables had been rebuilt by just export and import the database. Just few days back, I…
ursitesion
  • 2,071
  • 7
  • 32
  • 45
1
vote
1 answer

Conditional Counting

I'm analyzing a database of login records for a university and I'm trying to write a query that will give me an idea as to how many users are using the labs for short bursts, verse a more extended stay. I have the query below query, which tells me…
Jacobm001
  • 319
  • 1
  • 15
1
vote
1 answer

How do I restore 3 tables into a MySQL database from a single Windows dump file?

I want to import 3 specific tables from a dump file that contains 270 tables. The dump file, naveen_ifs_db.sql, is 20 GB. How do I restore 3 tables from that dump-file using the command line in windows?
naani
  • 11
  • 1
1
vote
1 answer

Unable to update data from federated table automatically

I am trying to transfer data from remote Server to localhost through MySQL. In the remote server I created a database HOD and a table tab. In the localhost I created the database "HOD" and a table "tab". I also created a stored procedure…
Ramkumar S
  • 35
  • 4
0
votes
1 answer

I'm trying to restore single database from mysqldump all-databases with different name

I'm running mysql-server-5.1.73-3.el6_5.x86_64: mysql> SELECT VERSION(); +------------+ | VERSION() | +------------+ | 5.1.73-log | +------------+ 1 row in set (0.00 sec) mysql> I created mysqldump with option --all-databases, to create database…
alexus
  • 625
  • 5
  • 14
  • 28
0
votes
1 answer

Update query over nested select query

Want to update status of only those record whose a_msisdn count > 100 on specific date: mysql> select * from cc_info limit…