All Questions

628
votes
18answers
369853 views

Retrieving the last record in each group

There is a table messages that contains data as shown below: Id Name Other_Columns ------------------------- 1 A A_data_1 2 A A_data_2 3 A A_data_3 4 B B_data_...
27
votes
3answers
8042 views

Trouble with UTF-8 characters; what I see is not what I stored

I tried to use UTF-8 and ran into trouble. I have tried so many things; here are the results I have gotten: ???? instead of Asian characters. Even for European text, I got Se?or for Señor. Strange...
17
votes
1answers
2914 views

My PDO Statement doesn't work

This is my PHP sql statement and it's returning false while var dumping $password_md5 = md5($_GET['password']); $sql = $dbh->prepare('INSERT INTO users(full_name, e_mail, username, password, passw...
240
votes
12answers
382215 views

Connect Java to a MySQL database

How do you connect to a MySQL database in Java?
435
votes
14answers
317809 views

MySQL Error 1093 - Can't specify target table for update in FROM clause

I have a table story_category in my database with corrupt entries. The next query returns the corrupt entries: SELECT * FROM story_category WHERE category_id NOT IN ( SELECT DISTINCT category....
430
votes
13answers
403022 views

How to do a FULL OUTER JOIN in MySQL?

I want to do a Full Outer Join in MySQL. Is this possible? Is a Full Outer Join supported by MySQL?
261
votes
13answers
234700 views

Using LIMIT within GROUP BY to get N results per group?

The following query: SELECT year, id, rate FROM h WHERE year BETWEEN 2000 AND 2009 AND id IN (SELECT rid FROM table2) GROUP BY id, year ORDER BY id, rate DESC yields: year id rate 2006 p01 ...
48
votes
1answers
62758 views

MySQL pivot row into dynamic number of columns

Lets say I have three different MySQL tables: Table products: id | name 1 Product A 2 Product B Table partners: id | name 1 Partner A 2 Partner B Table sales: partners_id | produ...
707
votes
10answers
469587 views

INNER JOIN ON vs WHERE clause

For simplicity, assume all relevant fields are NOT NULL. You can do: SELECT table1.this, table2.that, table2.somethingelse FROM table1, table2 WHERE table1.foreignkey = table2.primarykey...
145
votes
1answers
363069 views

The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead

When I attempt to connect to a MySQL server from PHP, I see the following error: Deprecated: The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /path...

Previous Next