Unix Technical Forum

problems with Group by

This is a discussion on problems with Group by within the MySQL forums, part of the Database Server Software category; --> Hi, I made a news Archiv und I have a problem with 'Group by' in a SQLquery what I ...


Go Back   Unix Technical Forum > Database Server Software > MySQL

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-17-2008, 06:13 AM
Matthias Roeder
 
Posts: n/a
Default problems with Group by

Hi,

I made a news Archiv und I have a problem with 'Group by' in a SQLquery
what I don't understand is what is going on,
because for some months it works really fine and for other months it
doesn't.
in the months that don't work the following situation happens.
The query gives me only the first dates and supresses the ohters.
If I check the select without 'group by', I get all dates.

I didn't see any differences between the entries in the database
by the months what work and the months that don't work.

I don't know what to do right now, only what I can see right now that
the date and idnumber are not in order.
i think the user, who have the entry rights didn't edit the datas,
they delete them and wrote them new.

but does it really matter, cause the query takes the datas corectly
without 'group by'only the Group by doesn't work.

Beside english is not my motherlanguage I hope you can undertstand my
problem.

thanks alot for any help

bye
Matth


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 03-17-2008, 06:13 AM
Rik Wasmus
 
Posts: n/a
Default Re: problems with Group by

On Thu, 13 Mar 2008 13:47:23 +0100, Matthias Roeder <info@vmind.de> wrote:

> Hi,
>
> I made a news Archiv und I have a problem with 'Group by' in a SQLquery
> what I don't understand is what is going on,
> because for some months it works really fine and for other months it
> doesn't.
> in the months that don't work the following situation happens.
> The query gives me only the first dates and supresses the ohters.
> If I check the select without 'group by', I get all dates.
>
> I didn't see any differences between the entries in the database
> by the months what work and the months that don't work.
>
> I don't know what to do right now, only what I can see right now that
> the date and idnumber are not in order.
> i think the user, who have the entry rights didn't edit the datas,
> they delete them and wrote them new.
>
> but does it really matter, cause the query takes the datas corectly
> without 'group by'only the Group by doesn't work.
>
> Beside english is not my motherlanguage I hope you can undertstand my
> problem.


We can't understand your problem without:
1) A description of the database (SHOW CREATE TABLE tablename)
2) The actual query you're using.
--
Rik Wasmus
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 03-17-2008, 06:13 AM
Matthias Roeder
 
Posts: n/a
Default Re: problems with Group by

> We can't understand your problem without:
> 1) A description of the database (SHOW CREATE TABLE tablename)
> 2) The actual query you're using.



Hi,
my table is
CREATE TABLE `news2` (
`newsid` int(11) NOT NULL auto_increment,
`datum` date NOT NULL,
`kommentar` text collate latin1_german2_ci NOT NULL,
`ueberschrift` varchar(200) collate latin1_german2_ci NOT NULL default
PRIMARY KEY (`ID`)
)

my query is
SELECT DAYOFMONTH( `datum` ) AS Tag, MONTH( `datum` ) AS `Monat` , YEAR(
`datum` ) AS `Jahr`
FROM `news2`
GROUP BY Jahr, Monat
ORDER BY Jahr DESC , Monat DESC


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:20 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com