At 19:50 +0200 7/22/03, PaT! wrote:
Hi,

I have a table:

+-------------+--------------------------+------+-----+---------+-------
---------+
| Field       | Type                     | Null | Key | Default | Extra
|
+-------------+--------------------------+------+-----+---------+-------
---------+
| id          | int(11)                  |      | PRI | NULL    |
auto_increment |
| NUMFATT     | int(5) unsigned zerofill |      |     | 00000   |
|
| dataemiss   | date                     | YES  |     | NULL    |
|
+-------------+--------------------------+------+-----+---------+-------
---------+
(the table has more fields but I removed them to semplify the view of
it)

where I want to create a UNIQUE index with two tables
'dataemiss' and 'NUMFATT'
'dataemiss' is a date format and in the index I want to consider just
the year part of the date.

You cannot do that for DATE values. If you store your dates as separate year, month, and day columns, then you could create a unique index on the year column.

I cannot change the field type setting it as a string (ex. char, var,
etc.).
any hint on how to do it?

The goal of this is index is to avoid to insert the same 'NUMFATT' twice
or more in the same year.

I'm using MySQL 4.0.13 on Win 2K server

Thanks
Patrizio


--
Paul DuBois, Senior Technical Writer
Madison, Wisconsin, USA
MySQL AB, www.mysql.com

Are you MySQL certified? http://www.mysql.com/certification/


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



Reply via email to