bcarl314
10-22-2003, 06:13 PM
I'm migrating a program from PHP/mySQL to PHP/SQL Server (not my idea) and am having some minor problems with the SQL.
I've got a table (results) set up as follows...
questionID int not null,
resultText varchar(255) not null,
lastUpdated datetime
Now, on mySQL I ran this query...
SELECT DISTINCT resultText FROM results ORDER BY lastUpdated
which worked great.
On SQL Server, appearenlty you need to include the filed which you want to order by in the select statement.
IE my new query is...
SELECT DISTINCT resultText, lastUpdated FROM results ORDER BY lastUpdated.
Since lastUpdated is almost always unique, I get the entire table returned.
All I want is the unique results from the resutls table ordered by the lastUpdated column. Any ideas?
I've got a table (results) set up as follows...
questionID int not null,
resultText varchar(255) not null,
lastUpdated datetime
Now, on mySQL I ran this query...
SELECT DISTINCT resultText FROM results ORDER BY lastUpdated
which worked great.
On SQL Server, appearenlty you need to include the filed which you want to order by in the select statement.
IE my new query is...
SELECT DISTINCT resultText, lastUpdated FROM results ORDER BY lastUpdated.
Since lastUpdated is almost always unique, I get the entire table returned.
All I want is the unique results from the resutls table ordered by the lastUpdated column. Any ideas?