No problem, this is:

Kardex Table:
+---------------+-------------+------+-----+---------+-------+
| Field         | Type        | Null | Key | Default | Extra |
+---------------+-------------+------+-----+---------+-------+
| Nro           | bigint(20)  |      | PRI | 0       |       |
| Fecha         | datetime    | YES  |     | NULL    |       |
| CodProducto   | bigint(20)  | YES  |     | 0       |       |
| Ref           | varchar(50) | YES  |     | NULL    |       |
| Empresa       | varchar(50) | YES  |     | NULL    |       |
| Cant          | double      | YES  |     | 0       |       |
| Balance       | double      | YES  |     | 0       |       |
| BalanceLitros | varchar(50) | YES  |     | NULL    |       |
| CantKilos     | double      | YES  |     | 0       |       |
| BalanceKilos  | double      | YES  |     | 0       |       |
+---------------+-------------+------+-----+---------+-------+

So im using MySQL 4.1 and still receive the same error for the subselect
query.

And I have other question, i trying to figure how to get the max date
for a certain group of records, here an example:

Cod     Product         date
10      Nissan Car              2003-06-20
20      Guitar Yamaha   2003-07-01
10      Nissan Car              2003-05-01
30      Stereo Cables   2003-01-20
20      Guitar Yamaha   2003-10-05
10      Nissan Car              2003-08-10
10      Nissan Car              2003-07-20
20      Guitar Yamaha   2003-09-10


So I have 3 groups, grouping by Cod 10,20,30 i need to build a query to
get the max date of every group, the result must be something like this

Cod     Product         date
10      Nissan Car              2003-08-10
20      Guitar Yamaha   2003-10-05
30      Stereo Cables   2003-01-20

I try the following query with no look
SELECT product, MAX(date) FROM table GROUP BY cod

And other combination using the HAVING syntax.

Please help!!

-----Original Message-----
From: Michael Satterwhite [mailto:[EMAIL PROTECTED] 
Sent: Sábado, 19 de Julio de 2003 08:36 p.m.
To: [EMAIL PROTECTED]
Subject: Re: Subselect in 4.0.12-max with --new option

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

On Friday 18 July 2003 21:28, [EMAIL PROTECTED] wrote:

> ERROR 1064: You have an error in your SQL syntax.  Check the manual
that
> corresponds to your MySQL server version for the right syntax to use
> near ….
>
> Any ideas? I need subselect working. Please help!!!

Any chance you could post the table structure and the SQL statement that
got 
the error?


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

iD8DBQE/GeQBjeziQOokQnARAmG6AJ4p3dAjtUmNzuueHHAhtecsE0+/EACfSjlF
3qWktDP00+Biu82iTKnyeRw=
=RO1D
-----END PGP SIGNATURE-----


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


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

Reply via email to