Monday, March 19, 2012

Keyword "Top" can't be used in SQL Mobile, is there any substitute?

I only want to select few records from table

Keyword "Top" can't be used in SQL Mobile, is there any substitute?

According to

http://www.craigsmullins.com/ssu_0900.htm

Transact-SQL

SELECT TOP 10 TITLE, PRICE
FROM TITLES
ORDER BY PRICE DESC

can be expressed as SQL

SELECT TITLES, PRICE
FROM TITLES A
WHERE 10 > (SELECT COUNT(*)
FROM TITLES B
WHERE A.PRICE < B.PRICE)
AND PRICE IS NOT NULL
ORDER BY PRICE DESC

Robert Wishlaw

|||There is the good point made about the T-SQL extensions. Do we know what SQL is supported - is it SQL-99?

I think the development team have done a really good job getting so much functionality into such a small package|||

Thank for your help! I have read your reply seriously

But I want to have a solution which doesn't need to compare the value of the table. Just get a fixed number of rows from the SQL Mobile table in no particular order like using "Top" keyword in the Transact-SQL

|||

BrianSquibb wrote:

There is the good point made about the T-SQL extensions. Do we know what SQL is supported - is it SQL-99?

I think the development team have done a really good job getting so much functionality into such a small package

Hi Brian:

The SSCE BOL says that the grammar used by the query processor is a subset of the Transact-SQL grammar supported by Microsoft SQL Server 2005. It would be interesting to compare the SSCE grammar with that used by SQLite.

Robert Wishlaw

|||As the difference between SQL99 and SQL2003 is XML Support, I would suggest that CE is SQL 99 compliant

No comments:

Post a Comment