Re: Searching for Dates

2007-03-17 Thread Dan Nelson
In the last episode (Mar 16), Bob Cooper said: > I am working with MySQL ver 5.1 on a Ubuntu Linux x86_64. I am new to > both SQL and MySQL. I have been able to query out most of the data I > need from my tables without any issues but his one has stumped me. > > I am trying to query data associate

Re: Group By / Order BY

2007-03-17 Thread Peter Brawley
>I want to pull distinct rows (there could be as many as 30 rev's >per date) and the data on that row. so.. I'd like to get the following GROUP BY groups by aggregate value, not by row. Use a WHERE clause to return a row corresponding to the value of a column. PB Justin wrote: hmm.. that work

Re: Group By / Order BY

2007-03-17 Thread Justin
hmm.. that worked.. but I guess I forgot to mention.. I don't need the value of the rev.. I wanted to return that row.. like.. let me put some more info date revtext desc - 20070315 1

Re: Group By / Order BY

2007-03-17 Thread Olexandr Melnyk
1) ORDER BY is executed after GROUP BY; 2) In ORDER BY don't use columns that aren't in GROUP BY, unless it's an aggregated value; Your query can be rewritten as: select date , max(rev) as max_rev from table group by date order by max_rev desc 2007/3/17, Justin <[EMAIL PROTECTED]>:

Group By / Order BY

2007-03-17 Thread Justin
I've got an issue with group / order by.. here's what I'm wondering.. simple table.. date | rev -- 20070315 1 20070315 2 20070316 1 20070316 2 Query I'm running SELECT * FROM `table` GROUP BY `date` order by `rev` DESC I wo

Searching for Dates

2007-03-17 Thread Bob Cooper
Hi, I am working with MySQL ver 5.1 on a Ubuntu Linux x86_64. I am new to both SQL and MySQL. I have been able to query out most of the data I need from my tables without any issues but his one has stumped me. I am trying to query data associated with specific dates. The dates are not sequential

RE: How does one transpose a group of columns into rows?

2007-03-17 Thread Tim Lucia
I don't know if this is optimal or not, but it does work... DROP TABLE IF EXISTS `x`; CREATE TABLE `x` ( `id` int(11) default NULL, `path1` varchar(10) default NULL, `display` varchar(10) default NULL, `value` varchar(10) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8; insert into x va