Thursday, April 30, 2009

Complicated Queries in LIKE

FROM `zen_tax_rates`
ORDER BY tax_rates_id = (
SELECT tax_rates_id
FROM zen_tax_rates
WHERE tax_description
LIKE '%sample%'

by this query the selection field value in the ORDER clause is chosen by dynamic using the WHERE clause value and ASC is used here because the selection value is need to be displayed as last record in the fetch. If we want to display the selection record need to be displayed a first record in the fetch we need simply to put DESC in the ORDER BY in this query.

more info..

No comments: