-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tuesday 22 July 2003 22:28, [EMAIL PROTECTED] wrote:
> Sorry I completely  forget the query:
> SELECT * FROM Kardex WHERE Fecha IN (SELECT maxfecha FROM fechas)

> P.D. Im using 4.1 alpha version for win32

OK, something is still missing. I went to my Windows box today (running 4.1), 
and created a couple of tables. Here's the result of the session:

 --------------
desc table1
- --------------
+-------+----------+-------------------+------+-----+---------+---------
- -------+
| Field | Type     | Collation         | Null | Key | Default | Extra
|
+-------+----------+-------------------+------+-----+---------+---------
- -------+
| id    | int(11)  | binary            |      | PRI | NULL    |
auto_increment |
| date1 | datetime | latin1_swedish_ci | YES  |     | NULL    |
|
+-------+----------+-------------------+------+-----+---------+---------
- -------+
2 rows in set (0.40 sec)

- --------------
desc table2
- --------------
+-------+----------+-------------------+------+-----+---------+---------
- -------+
| Field | Type     | Collation         | Null | Key | Default | Extra
|
+-------+----------+-------------------+------+-----+---------+---------
- -------+
| id    | int(11)  | binary            |      | PRI | NULL    |
auto_increment |
| Date2 | datetime | latin1_swedish_ci | YES  |     | NULL    |
|
+-------+----------+-------------------+------+-----+---------+---------
- -------+
2 rows in set (0.00 sec)

- --------------
Select * from Table1
- --------------
+----+---------------------+
| id | date1               |
+----+---------------------+
|  1 | 2003-07-22 07:41:00 |
|  2 | 2003-07-21 07:41:00 |
|  3 | 2003-07-21 08:26:00 |
|  4 | 2003-07-28 08:26:00 |
+----+---------------------+
4 rows in set (0.00 sec)

- --------------
Select * from table2
- --------------
+----+---------------------+
| id | Date2               |
+----+---------------------+
|  1 | 2003-07-22 07:41:00 |
|  2 | 2003-07-21 07:41:00 |
+----+---------------------+
2 rows in set (0.00 sec)

- --------------
Select * from Table1
Where Date1 in (Select Date2 from Table2)
- --------------
+----+---------------------+
| id | date1               |
+----+---------------------+
|  1 | 2003-07-22 07:41:00 |
|  2 | 2003-07-21 07:41:00 |
+----+---------------------+
2 rows in set (0.00 sec)

- -------------------------------
As you can see, I created two tables (Table1 and Table2) and populated them.  
The SubSelect executes without error. Obviously something is missing.

Suggestion: Go into MySQL and run the following:

Select maxfecha from fechas;
SELECT * FROM Kardex WHERE Fecha IN (SELECT maxfecha FROM fechas);

And copy the entire session (including any error messages) for us to look at. 
If  the fechas table is large, only send us 4-5 rows so we can see it worked. 
Subselect works fine, so it's probably something small.

- ---Michael


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux)

iD8DBQE/HxuCjeziQOokQnARAlREAJ0eibYiMMu9J74cNX4ElozMWyqHxQCgrMlV
tDmsxAlgRvXELRSLt1lXvj8=
=M+jO
-----END PGP SIGNATURE-----


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to