Online Suche im Handbuch |
Support für MySQL wird vielerorts angeboten. bevor Sie sich jedoch an die Entwickler oder an kommerzielle Supportstellen wenden, lesen Sie bitte ausführlich das Handbuch durch. Viele Probleme lösen sich hierbei von alleine. Trotzdem können natürlich BUGS in MySQL enthalten sein. Um einen Bug-Report zu erstellen, sollte man das Formular mysqlbug aus dem Verzeichnis ../scripts (bei der Source-Distribution) bzw. aus dem Verzechnis ../bin (bei der Binary-Distribution) benutzen. Dieses Script fragt nach weiteren Informationen bezüglich des verwendeten Betriebssystems, der Konfiguration, u.s.w., welche unentbehrlich bei der Rekonstruktion des Fehlers sind. Ohne diese ausführlichen Informationen kann Support generell nicht geleistet werden. In dem BUG-Report müssen unbedingt folgende Informationen enthalten sein:
mysql> SHOW VARIABLES;
mysql> EXPLAIN SELECT ...
<output-from-EXPLAIN>
mysql> FLUSH STATUS;
mysql> SELECT ...
<Hier könnte eine kurze Ausgabe eines MySQL Statements stehen>
mysql> SHOW STATUS;
<Ausgabe von SHOW STATUS>
mysqladmin variables extend-status processlist
Besonders Entwickler - freundlich ist der folgende BUG Report, der mit dem phpMyAdmin Toolkit ganz einfach über die Funktion "DUMP" zu generieren ist:
I have a simple table, EventDateTbl that contains the following columns:
mysql> describe EventDateTbl;
+------------+---------+------+-----+------------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+---------+------+-----+------------+-------+
| event_date | date | | PRI | 0000-00-00 | |
| type | int(11) | | PRI | 0 | |
| event_id | int(11) | | PRI | 0 | |
+------------+---------+------+-----+------------+-------+
3 rows in set (0.00 sec)
A simple date range select seems okay:
mysql> select event_date,type,event_id from EventDateTbl
WHERE event_date >= "1999-07-01" AND event_date < "1999-07-15" ORDER BY
event_date;
+------------+--------+----------+
| event_date | type | event_id |
+------------+--------+----------+
| 1999-07-10 | 100100 | 24 |
| 1999-07-11 | 100100 | 25 |
| 1999-07-13 | 100600 | 0 |
| 1999-07-13 | 100600 | 4 |
| 1999-07-13 | 100600 | 26 |
| 1999-07-14 | 100600 | 10 |
+------------+--------+----------+
6 rows in set (0.00 sec)
And, if I add a single type to the WHERE, it also seems to work:
mysql> select event_date,type,event_id from EventDateTbl
WHERE event_date >= "1999-07-01" AND event_date < "1999-07-15"
AND (type=100600) ORDER BY event_date;
+------------+--------+----------+
| event_date | type | event_id |
+------------+--------+----------+
| 1999-07-13 | 100600 | 0 |
| 1999-07-13 | 100600 | 4 |
| 1999-07-13 | 100600 | 26 |
| 1999-07-14 | 100600 | 10 |
+------------+--------+----------+
4 rows in set (0.01 sec)
But, if make it select on two different types, I get odd looking results
with repeating results, and if I add another type=n in the query, I'll get
three results, etc.:
mysql> select event_date,type,event_id from EventDateTbl
WHERE event_date >= "1999-07-01" AND event_date < "1999-07-15"
AND (type=100600 OR type=100100) ORDER BY event_date;
+------------+--------+----------+
| event_date | type | event_id |
+------------+--------+----------+
| 1999-07-10 | 100100 | 24 | <-- July 10th
| 1999-07-11 | 100100 | 25 |
| 1999-07-13 | 100600 | 0 |
| 1999-07-13 | 100600 | 4 |
| 1999-07-13 | 100600 | 26 |
| 1999-07-14 | 100600 | 10 |
| 1999-07-10 | 100100 | 24 | <-- July 10th DUP, despite order by Date
| 1999-07-11 | 100100 | 25 |
| 1999-07-13 | 100600 | 0 |
| 1999-07-13 | 100600 | 4 |
| 1999-07-13 | 100600 | 26 |
| 1999-07-14 | 100600 | 10 |
+------------+--------+----------+
12 rows in set (0.01 sec)
Per another suggestion, I tried changing the 'type' clause to be:
AND type IN (100600,100100)
but the results are the same.
This is odd to me because I have an ORDER BY that should put everything in
date order, but that's not the case. I first noted this with a slightly more
complex query (the one I really want to work, but I couldn't even get the
trivial one to work).
mysql> select event_date,type,COUNT(type) from EventDateTbl
WHERE event_date >= "1999-07-01" AND event_date < "1999-07-15"
AND (type=100600 OR type=100100) GROUP BY event_date,type;
+------------+--------+-------------+
| event_date | type | COUNT(type) |
+------------+--------+-------------+
| 1999-07-10 | 100100 | 1 |
| 1999-07-11 | 100100 | 1 |
| 1999-07-13 | 100600 | 3 |
| 1999-07-14 | 100600 | 1 |
| 1999-07-10 | 100100 | 1 |
| 1999-07-11 | 100100 | 1 |
| 1999-07-13 | 100600 | 3 |
| 1999-07-14 | 100600 | 1 |
+------------+--------+-------------+
8 rows in set (0.08 sec)
When I specify NO "type=nnn" in the WHERE CLAUSE, or when I have just ONE
"AND type=nnn" it works fine, but if I put two types in, separated by ORs, I
get the odd results.
What am I doing wrong?
Thanks,
David Wall
....
Here's the table dump for those that are interested:
# MySQL dump 6.0
#
# Host: localhost Database: eastside
#--------------------------------------------------------
# Server version 3.22.25-log
#
# Table structure for table 'EventDateTbl'
#
CREATE TABLE EventDateTbl (
event_date date DEFAULT '0000-00-00' NOT NULL,
type int(11) DEFAULT '0' NOT NULL,
event_id int(11) DEFAULT '0' NOT NULL,
PRIMARY KEY (event_date,type,event_id),
KEY event_id (event_id)
);
#
# Dumping data for table 'EventDateTbl'
#
INSERT INTO EventDateTbl VALUES ('1999-07-10',100100,24);
INSERT INTO EventDateTbl VALUES ('1999-07-11',100100,25);
...
INSERT INTO EventDateTbl VALUES ('1999-09-19',100100,37);
INSERT INTO EventDateTbl VALUES ('2000-12-18',100700,38);
Kommerzieller Support für MySQL wird u.a. von den Programmierern von
MySQL auf
http://www.mysql.com angeboten. Hierbei wird zwischen verschiedenen
Level unterschieden:
Online Suche im Handbuch |