Re: [SQL] Another constant in foreign key problem.

2012-02-23 Thread Gary Stainburn
Sorry, I missed one table. The users_facility_levels table is used to link the three tables listed below to give the lever per user/facility. On Wednesday 22 February 2012 11:18:23 Oliveiros d'Azevedo Cristina wrote: > Hi, Gary, > > I'm answering by editing your e-mail > __ > > >I have thr

Re: [SQL] Another constant in foreign key problem.

2012-02-22 Thread Gary Stainburn
Thank you to you both. I was thinking that I wasn't going to be able to do this. As the use of these tables is purely to control the web interface to this database I have decided control this via the application rather than within the database. It will require less coding and is simpler. On W

Re: [SQL] Another constant in foreign key problem.

2012-02-22 Thread Philip Couling
Hi Gary In short you can't have a foreign key here because foreign keys are just that: a *key* from another table. fl_level is not a key, it is not unique and requires fl_f_id to be unique. If you want a foreign key between these two tables then you must add the facility id to the document libra

Re: [SQL] Another constant in foreign key problem.

2012-02-22 Thread Oliveiros d'Azevedo Cristina
Hi, Gary, I'm answering by editing your e-mail __ I have three tables, users - all users of my web site facilities - facilities available on my web site facility_levels - access levels per user/facility. One of my facilities is a document library (f_id = 22) For this facility I have the

[SQL] Another constant in foreign key problem.

2012-02-22 Thread Gary Stainburn
I have three tables, users - all users of my web site facilities - facilities available on my web site facility_levels - access levels per user/facility. One of my facilities is a document library (f_id = 22) For this facility I have the levels select * from facility_levels where fl_f_id=22 orde