Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2004

    Unanswered: Preventing duplicate values

    Hi, I have a table "Sales", where I have the fields "date", "location" and "points". The field "date" internally tracks the date of entry using the function date(). The other two fields have to be entered by the user. I need help whereby on a particular date; for a particular location the points can be entered only once. If the user tries to enter the points for the same location on the same day; it should show an error message. He can enter points for that location only the next day. That is suppose for a location "Texas" for date "1/27/2004" there can be only one entry. Can anyone please help?

  2. #2
    Join Date
    Apr 2002
    Toronto, Canada
    run the following query to set up a unique constraint:
    create unique index datelocation
    on sales ( [date] , location ) | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts