You are here: Re: advanced search through table « PHP SQL « IT news, forums, messages
Re: advanced search through table

Posted by ZeldorBlat on 06/09/06 05:27

Piratron wrote:
> Hi ppl,
>
> I need help regarding table search.
>
> This is the table structure
> ----------------------------
> thank_id int(10)
> member_id int(10)
> topic_id int(10)
> post_id int(10)
> thank_date int(10)
> ----------------------------
>
> I need mysql code which will perform search through this table and find
> unique
> member_id where topic_id are various sets of 50 or more integers.
> actually I'll need to find a member who posted in all those topics that
> I'm searching...
>
> please note that this table has more than 50,000 rows thus one instance
> ofr topic_id can return more than 200 rows.
>
> I need this code only to find one member_id, it doesnt have to be ultra
> fast ;)
>
> thanks in advance,
>
> regards,
>
> Piratron
>
>
> --
> ------------------------------------------------------------------------
> visit our site at:
> www.symbian-mobile.org
>
> Regards,
> Symbian-Mobile Team

For illustration purposes suppose you only had 3 topics (topic_id's 20,
42, and 69). Then something like this should work:

select member_id
from theTable
where topic_id in (20, 42, 69)
group by member_id
having count(distinct topic_id) = 3

 

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

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