You are here: Re: sql counting duplicates « All PHP « IT news, forums, messages
Re: sql counting duplicates

Posted by Dejan on 04/15/06 12:09

The solution is:

select grad_pbroj, Naziv, COUNT(*) as brojac from smjestaj left join grad on
grad.grad=smjestaj.grad_pbroj group by grad_pbroj order by grad_pbroj ASC

bye
Dejan


Jerry Stuckle <jstucklex@attglobal.net> wrote in message
news:efWdnQg04YVXZqLZnZ2dnUVZ_tGdnZ2d@comcast.com...
> Dejan wrote:
> > Yeah, i know that, buth i have left join...order by ... group by.
> >
> > And i have sql syntax error, and don't know how to display related
coloumn,
> > and number of duplicates.
> >
> >
> > Sjoerd <sjoerder@gmail.com> wrote in message
> > news:1145009057.659424.240850@u72g2000cwu.googlegroups.com...
> >
> >>Dejan wrote:
> >>
> >>>Now i wanna display all the grad_pbroj coloumns from 'smjestaj', buth
> >
> > not
> >
> >>>displaying duplicates, just to count them, and put the count behind the
> >>>'grad_pbroj' coloumn.
> >>>
> >>>Result:
> >>>Naziv_first (3)
> >>>Naziv_second (1)
> >>>Naziv_third (8)
> >>
> >>Is this what you want?
> >>
> >>SELECT first_column, COUNT(*) FROM my_table GROUP BY first_column;
> >>
> >
> >
> >
>
> Well, post your attempt(s) and maybe we can see what's wrong!
>
> Sjoerd showed you how to do it. We can't do much more with the
information
> you've provided.
>
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstucklex@attglobal.net
> ==================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация