AllenGarner
Programmer
I need to be able to order results based on several criteria.
I need to be able select all records where field:group = 'value given'
and display results sorted by these criteria
1) if field:company is not empty then display field:company asc
2) if field:company is empty then display field:fullname asc if not empty
3) if field:company and field:fullname are empty then display field:lastname asc if not empty
4)if field:company and field:fullname and field:lastname are empty display field:firstname if not empty
these results would be easy if I could just sort all by say company but if some fields in the group have an empty company field then it doesn't get included how can I sort by all these criteria. how could I get all the records in group sorted if some fields will be empty and others not
Any Ideas? My Brain is fried now going into overload can anyone help?
I need to be able select all records where field:group = 'value given'
and display results sorted by these criteria
1) if field:company is not empty then display field:company asc
2) if field:company is empty then display field:fullname asc if not empty
3) if field:company and field:fullname are empty then display field:lastname asc if not empty
4)if field:company and field:fullname and field:lastname are empty display field:firstname if not empty
these results would be easy if I could just sort all by say company but if some fields in the group have an empty company field then it doesn't get included how can I sort by all these criteria. how could I get all the records in group sorted if some fields will be empty and others not
Any Ideas? My Brain is fried now going into overload can anyone help?