Working with MySQL

matthewd@carbonara:~$ mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2792799
Server version: 5.0.38-log Gentoo Linux mysql-5.0.38

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use b3
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> SELECT count(*) FROM interaction WHERE idRecord=3720322;
+----------+
| count(*) |
+----------+
|       30 |
+----------+
1 row in set (0.00 sec)

mysql> SELECT count(*) FROM interaction WHERE idRecord=3720322 ORDER BY `create` DESC, `id` DESC;
+----------+
| count(*) |
+----------+
|       30 |
+----------+
1 row in set (0.00 sec)

mysql> SELECT * FROM interaction WHERE idRecord=3720322;
+---------+---------------------+----------+--------+-----------+
| id      | create              | idRecord | idUser | idOutcome |
+---------+---------------------+----------+--------+-----------+
... snip 30 rows ...
+---------+---------------------+----------+--------+-----------+
30 rows in set (0.01 sec)

mysql> SELECT * FROM interaction WHERE idRecord=3720322 ORDER BY `create` DESC, `id` DESC;
Empty set (0.00 sec)

mysql>

Isn’t MySQL grand?

This entry was posted on Monday, July 2nd, 2007 at 11:48 am and is filed under mysql. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

2 Responses to “Working with MySQL”

  1. dingbats Says:

    Did you figure out why this was happening?

  2. Matthew Says:

    Yeah I did, the table turned out to be corrupt. It would have been nicer if MySQL displayed an error rather than returning invalid results though.

Leave a Reply