Hi,
I cant find solution for this problem :
I would like to sort companies by several categories.
Every company can be in more categories.
It means that one category can be common for more companies.
There is an example of table where are companies and categories together :
Each category is here representing by a number :
Name of company category number
Company1 1
Company1 2
Company1 3
Company 2 1
Company 2 3
Company3 4
My problem is :
If I do query to find companies with category number 1 and 2 and 3 the result is Company1 and Company2. It is ok, BUT I dont know how to do query which can find company which has category 1 and also 2. The result at this moment must be only Company1.
I know that I can do it with step by step query - the first find all companies with category1 and the second query find all companies with category2 from the result of the first query. But I dont know how to do it when the number of choosed cathegories in search form will difrent all the time - so I cant know in advance how much queries I will need...
If you have idea, pleas help me with it.
Thank you
Jiri
I cant find solution for this problem :
I would like to sort companies by several categories.
Every company can be in more categories.
It means that one category can be common for more companies.
There is an example of table where are companies and categories together :
Each category is here representing by a number :
Name of company category number
Company1 1
Company1 2
Company1 3
Company 2 1
Company 2 3
Company3 4
My problem is :
If I do query to find companies with category number 1 and 2 and 3 the result is Company1 and Company2. It is ok, BUT I dont know how to do query which can find company which has category 1 and also 2. The result at this moment must be only Company1.
I know that I can do it with step by step query - the first find all companies with category1 and the second query find all companies with category2 from the result of the first query. But I dont know how to do it when the number of choosed cathegories in search form will difrent all the time - so I cant know in advance how much queries I will need...
If you have idea, pleas help me with it.
Thank you
Jiri