Home > Archive > PHP SQL > June 2006 > advanced search through table
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
advanced search through table
|
|
| Piratron 2006-06-17, 8:10 am |
| 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
| |
| ZeldorBlat 2006-06-17, 8:10 am |
|
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
| |
| Piratron 2006-06-17, 8:10 am |
| 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
|
|
|
|
|