advanced search through table
am 09.06.2006 02:03:11 von Piratron
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
Re: advanced search through table
am 09.06.2006 07:27:16 von zeldorblat
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
Re: advanced search through table
am 09.06.2006 15:44:33 von Piratron
ZeldorBlat wrote:
>
> 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
>
Thank you very much, it works perfect ;)
--
------------------------------------------------------------ ------------
visit our site at:
www.symbian-mobile.org
Regards,
Symbian-Mobile Team