You just list the things to order by in the order by clause, seperated
by a comma:

order by $first, $second

It's designed to work exactly as you need.

cheers
andrew

On 27 January 2010 21:30, Anurag Saxena <[email protected]> wrote:
> Hi,
>
> I am executing the search query which returns the result and now i need to
> sort them on the basis of condition.......
>
> i need to order by the result if element abc exists in the documents of
> result set, if it dose not exists in the document of result set then order
> by xyz element if it is available in the document.
>
> What it means is i have to sort the result set on the basis of first element
> and if it dose not exists then i have to do the sorting on another element.
>
> below scenarios can be available in the data/result set of search.....
>
> 1. Document may have only first element
> 2. Document may have only second element
> 3. document may have both the elements
> 4. document may have none of the element
>
> So sorting should be done on the preference of first element if it is
> available and if not available then sorting should be done on another
> element.
> It means my final output should have sorted result set mixed on the basis of
> first and second element on the basis of their respective availability.
>
> Can some body please help me out here (how to achieve the expected behavior)
> if you have done it earlier or faced the same situation.
> Also what would be the behavior of document which do not have any of the
> element for ascending and descending condition. means will they come in
> first or last always?
>
> you can assume that my search is working perfectly fine and i just need to
> add the order by clause.
>
>
> Thanks
> Anu
>
> _______________________________________________
> General mailing list
> [email protected]
> http://xqzone.com/mailman/listinfo/general
>
>



-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to