Hi all,
is this a bad ?
i have a master table with all info (11 fields), but countries are stored as code(Us, UK, FR etc), types as code (1, 2, 3 etc) and sectors as codes (1,2,3,4 etc)
There is a countries table : country (code, engname (english name), frename (french), spaname (spanich)
and a types table (code, engtype (english ), fretype (french), spatype)
there is also a sectors table (code, engname, frename, spaname)
The following query works. But i'm still in the testing stage and my main table has 120 records.
The statement below looks to me un-elegant, complex and may slow things down once i'm in the production stage.
What do you thing please ???
$sql = "SELECT mastertable.name, mastertable.category, mastertable.products, types.type, country.engname FROM mastertable, country, types, sectors
WHERE (mastertable.products LIKE '%$search%' OR '$search' = '')
AND (mastertable.country = '$country' OR '$country' = 'All')
AND (mastertable.country = country.code)
AND (mastertable.category = '$category' OR '$category' = 'All')
AND (mastertable.type = '$type' OR '$type' = 'All')
AND (mastertable.type = types.code)
AND (mastertable.sector = '$sector' OR '$sector' = 'All')
And (mastertable.sector = sectors.code);
Regards to all