Reply to SQL Pagination With Dynamic Order By

Your name:

Reply:


Posted by rmturner76 on 04/04/07 15:26

I have a need to perform pagination while using dynamic sorting. As
an exmaple -

SELECT TOP(10) * FROM (
SELECT
TextColumn,
DecimalColumn,
ROW_NUMER() OVER (
ORDER BY
CASE @x
WHEN 1 THEN TextColumn
WHEN 2 THEN DecimalColumn
END
DESC
) AS SortOrder
FROM Table1
) AS Results WHERE SortOrder > ( 10 ) ORDER BY SortOrder

This is obviously just some sample but an error is given because the
data type of the 2 columns used in the order by are different. It
works if I cast DecimalColumn to match the textcolumn but then the
sorting is wrong. Is there a way to do this in a single query with 2
different data types?

Thanks for your help.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация