I think you should do 3 separate queries and apply 3 different filters. If the category number is an integer, you may need to convert it to character and compare the first character to 1, something like: substr(category number,1,1) = '1', etc for the other 2. I don't have much info, but I think that's how it would work. Then you create 3 tables and associate every table with a separate query.