I cannot get CGridView to sort and allow for any results other than pg1 of the results without getting this error out of the box.
Any ideas would be really helpful. Does anyone have working CGridView + sort by a column + click other than pg1 against the Microsoft SQL Server [2005 or 2008]?
It has been a little while since this post, but I would like to report the same problem. Well sort of… actually with SQL Server 2000 (don’t ask). I, however, seem to be getting a different error code.
Error 10007 – Column prefix [t] does not match a table name or alias
A trace shows that this query triggers the error:
SELECT * FROM (SELECT TOP 20 * FROM (SELECT TOP 40 * FROM [dbo].[_Ms_Deadlines] [t] ORDER BY [t].[EnrPer]) as [inner top table] ORDER BY [t].[EnrPer] DESC) as [outer top table] ORDER BY [t].[EnrPer] ASC
By the way, I am using dblib driver.
Anyone have any insight? This doesn’t seem to be a problem with other database sources.
The correct query should be (or at least seems like it should be):
(expected result)
SELECT * FROM (
SELECT TOP 20 * FROM (
SELECT TOP 40 * FROM [dbo].[_Ms_Deadlines] [t]
ORDER BY [t].[EnrPer]) as [__inner top table__]
ORDER BY [__inner top table__].[EnrPer] DESC) as [__outer top table__]
ORDER BY [outer top table].[EnrPer] ASC
Notice that the table aliases in the second two ‘order by’ clauses are mislabeled:
(actual result)
SELECT * FROM (
SELECT TOP 20 * FROM (
SELECT TOP 40 * FROM [dbo].[_Ms_Deadlines] [t]
ORDER BY [t].[EnrPer]) as [__inner top table__]
ORDER BY [t].[EnrPer] DESC) as [__outer top table__]
ORDER BY [t].[EnrPer] ASC
Have not yet started digging into the yii codebase yet to see what’s up, but I’m thinking it might actually be a PDO thing…