Forum Moderators: open
1. Axiomtek
2. Fabiatech
3. Acrosser
4.
5. ICOP
6. Ibase
7. Portwell
This is probably possible through PHP, but I want to do this through the database. How can I do something like this (Obviously, this doesn't work):
SELECT DISTINCT manufacturer FROM mp_products_all WHERE manufacturer!=''
Thanks in advance for the help,
Stefan
select distinct manufacturer from mp_products_all where manufacturer is not null and manufacturer<>'';
That way, if someone entered in a blank manufacturer string (rather than a default null value), that would get included.
I think if you allow searching products based on manufacturer it might be sensible to create an index on the manufacturer column. Then your!= logical operator would work fine. Something like the following two queries would get you there:
alter table mp_products_all modify column manufacturer char(128) not null default '';
alter table mp_products_all add index (manufacturer);
Otherwise if you've got 20,000 products and 700 manufacturers and you have a manufacturer search with no index then query times would be cumbersome. Come to think of it, even a "select distinct" would benefit from a manufacturer index.
Sean