Re: [PHP-DB] trying to dump out table info

2009-07-14 Thread h...@deweywilliams.com

Govinda wrote:



I learn the best by *seeing* example code.  I wish I could see a 
working example.


-G


Govinda,

Dan has shown you the path.  Good luck.

The problem I have always had with the PHP Manual (online) has been the 
lack of complete examples.  Yes, there are examples of how to use each 
function. But functions such as the MySQL related ones require multiple 
steps to get to a point where anything works.  There are  at least two 
steps to get any database function to work 1)connect to database 
2)select connected database.  Until these two things are correct, none 
of the other functions will work because you do not have a database to 
work on.


Great list

Dewey Williams



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



Re: [PHP-DB] Group by

2009-12-09 Thread h...@deweywilliams.com
The only SELECT is on MAX('timestamp').  There is really nothing to 
Group BY in this query.


Dewey

Philip Thompson wrote:

Hi.

In a mysql query, it is recommended that "GROUP BY" fields be indexed? Using 
EXPLAIN on one of my queries, I noticed no change between having indexed by GROUP BY 
field and not indexing it. Any thoughts would be appreciated.

In this example, should `history_field` be indexed...?

SELECT MAX(`timestamp`) AS `max_ts` 
FROM `history` 
WHERE `req_id` = 17 AND `history_record_id` = 35

GROUP BY `history_field`

Thanks,
~Philip
  



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