create index

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • PaT!

    #1

    create index

    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.
    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




    --
    MySQL General Mailing List
    For list archives: http://lists.mysql.com/mysql
    To unsubscribe: http://lists.mysql.com/mysql?unsub=m...ie.nctu.edu.tw

Working...