Re: [PHP] group by on mssql_query

2008-02-14 Thread Daniel Brown
On Thu, Feb 14, 2008 at 4:00 PM,  [EMAIL PROTECTED] wrote:
 $ford = mssql_query(SELECT name FROM Table GROUP BY name);

What do you see when you replace the above line with this?
$ford = mssql_query(SELECT name FROM Table GROUP BY name) or
die(mssql_get_last_message());


-- 
/Dan

Daniel P. Brown
Senior Unix Geek
? while(1) { $me = $mind--; sleep(86400); } ?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] group by on mssql_query

2008-02-14 Thread admin
Column 'location_city.dst' is invalid in the select list because it is not 
contained in either an aggregate function or the GROUP BY clause.

Not fimilar with MSSQL to be honest.




On Thu, Feb 14, 2008 at 4:00 PM,  [EMAIL PROTECTED] wrote:
 $ford = mssql_query(SELECT name FROM Table GROUP BY name);

What do you see when you replace the above line with this?
$ford = mssql_query(SELECT name FROM Table GROUP BY name) or
die(mssql_get_last_message());


-- 
/Dan

Daniel P. Brown
Senior Unix Geek
? while(1) { $me = $mind--; sleep(86400); } ?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] group by on mssql_query

2008-02-14 Thread admin
Sweet Mother it just clicked.
I got it thank you dan.




On Thu, Feb 14, 2008 at 4:00 PM,  [EMAIL PROTECTED] wrote:
 $ford = mssql_query(SELECT name FROM Table GROUP BY name);

What do you see when you replace the above line with this?
$ford = mssql_query(SELECT name FROM Table GROUP BY name) or
die(mssql_get_last_message());


-- 
/Dan

Daniel P. Brown
Senior Unix Geek
? while(1) { $me = $mind--; sleep(86400); } ?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] group by on mssql_query

2008-02-14 Thread Andrew Ballard
On Thu, Feb 14, 2008 at 4:13 PM, [EMAIL PROTECTED] wrote:

 Column 'location_city.dst' is invalid in the select list because it is not
 contained in either an aggregate function or the GROUP BY clause.

 Not fimilar with MSSQL to be honest.


Yes, MS SQL is strict and will not allow you to return columns as part of an
aggregate query unless they are either part of the GROUP BY clause or
aggregated with either a built-in aggregate function such as COUNT, SUM,
AVG, MAX, MIN, etc., or else a user-defined function or subquery (as the
error message indicates). If you're used to MySQL, it isn't so strict (but
IMO should be).

Andrew