claufranck
IS-IT--Management
My table structure is:
refsub (table name)
PROJET SUBSECTO
subsecto refsub (table name)
SUBSECTO LONGNAME
refchifrefsub (table name)
projet descript
refsub
Subsecto is a fk to a table that contains a list of subsectors
Projet is a FK that links the subsector to the project
subsecto
subsecto is a pk for the subsector
longname full subsector name
refchif
project is a pk for project number
descript description
refchif --> refsub <-- subsecto
A project can have multiple subsectors, but a query like this would't work
SELECT r.projet as project, descript as des FROM refchif r LEFT OUTER JOIN refsub rsb ON rsb.PROJET=r.PROJET LEFT OUTER JOIN subsecto ss ON rsb.SUBSECTO=ss.SUBSECTO WHERE ( (ss.subsecto like 'AGRIGENERA') and (ss.subsecto like 'LIVESTOCK_')) group by r.projet order by r.projet asc
using 'or' works
but several projects can be classified in several subsectors at once and I want to search by one or 2 or several of these subsectors for the same project number.
I know it very complex and a little vague I will provide anything you need to help me
refsub (table name)
PROJET SUBSECTO
subsecto refsub (table name)
SUBSECTO LONGNAME
refchifrefsub (table name)
projet descript
refsub
Subsecto is a fk to a table that contains a list of subsectors
Projet is a FK that links the subsector to the project
subsecto
subsecto is a pk for the subsector
longname full subsector name
refchif
project is a pk for project number
descript description
refchif --> refsub <-- subsecto
A project can have multiple subsectors, but a query like this would't work
SELECT r.projet as project, descript as des FROM refchif r LEFT OUTER JOIN refsub rsb ON rsb.PROJET=r.PROJET LEFT OUTER JOIN subsecto ss ON rsb.SUBSECTO=ss.SUBSECTO WHERE ( (ss.subsecto like 'AGRIGENERA') and (ss.subsecto like 'LIVESTOCK_')) group by r.projet order by r.projet asc
using 'or' works
but several projects can be classified in several subsectors at once and I want to search by one or 2 or several of these subsectors for the same project number.
I know it very complex and a little vague I will provide anything you need to help me