You are here: Re: get data from 2 tables, 1 is a count « PHP SQL « IT news, forums, messages
Re: get data from 2 tables, 1 is a count

Posted by dead on 10/14/25 11:30

On Thu, 27 Oct 2005 01:07:22 +0100, in alt.php.sql you wrote:

>On Thu, 27 Oct 2005 00:54:42 +0100, in alt.php.sql you wrote:
>
>
>>What I have is
>>select t1.count(*) as count,t2.*, from t1,t2 order by count
>>
>>But that gives me an error pointing to (*)
>>
>>Can anyone give me the proper syntax plus explanation.. please:)
>
>
>damm forgot the where
>ID=x
>
>select t1.count(*) as count,t2.* from t1,t2 where t1.id=ID and
>t2.id=ID order by count


got it working nearly :(

select count(t1) as count,t2.* from t1,t2 where t1.id=ID and
t2.id=ID group by t1.id order by count

BUT this only shows results from table 1 that also have soemhting in
table two... I need to show all results of table one even if nothing
in table two... i have tried replacing and with or ... that gives me
all results.. but the count is wrong :(

any help appreciated ? :)

 

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

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