Hi,

        My query is running very very VERY slowly and this is creating a lot of
troubles. Please, see it below and if u find something useful and faster
i'll be very grateful.

MYSQL >> SELECT idemailsent, email, idclient FROM wmkt_email_sent a,
wmkt_client b, wmkt_email c WHERE nMachine = 0 AND c.idemail=a.fkemail AND
b.fkemail=a.fkemail AND fkuser=1 AND fkpbl=23 ORDER BY email LIMIT 1000

the tables structures are:

mysql> show fields FROM wmkt_email_sent;
+-------------+---------------+------+-----+---------+----------------+
| Field       | Type          | Null | Key | Default | Extra          |
+-------------+---------------+------+-----+---------+----------------+
| idemailsent | int(11)       |      | PRI | NULL    | auto_increment |
| fkpbl       | int(11)       |      |     | 0       |                |
| fkemail     | int(11)       |      |     | 0       |                |
| dtSend      | timestamp(14) | YES  |     | NULL    |                |
| nResult     | int(11)       |      |     | 0       |                |
| dtLastUp    | timestamp(14) | YES  |     | NULL    |                |
| nMachine    | int(11)       |      |     | 0       |                |
+-------------+---------------+------+-----+---------+----------------+

mysql> show fields FROM wmkt_client;
+----------+---------------+------+-----+---------+----------------+
| Field    | Type          | Null | Key | Default | Extra          |
+----------+---------------+------+-----+---------+----------------+
| idclient | int(11)       |      | PRI | NULL    | auto_increment |
| realname | varchar(80)   |      |     |         |                |
| fkemail  | int(11)       |      |     | 0       |                |
| dtInsert | timestamp(14) | YES  |     | NULL    |                |
| dtLastUp | timestamp(14) | YES  |     | NULL    |                |
| fkuser   | int(11)       |      |     | 1       |                |
+----------+---------------+------+-----+---------+----------------+

mysql> show fields FROM wmkt_email;
+------------+--------------+------+-----+---------+----------------+
| Field      | Type         | Null | Key | Default | Extra          |
+------------+--------------+------+-----+---------+----------------+
| idemail    | int(11)      |      | PRI | NULL    | auto_increment |
| email      | varchar(255) |      | UNI |         |                |
| fklastresp | int(11)      |      |     | 0       |                |
+------------+--------------+------+-----+---------+----------------+

Thank u very much,
Edilson.


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to