You can join all three tables together
select d.members_id, m.name, old.name from data as d
left join members as m on m.members_id=d.members_id
left join oldmembers as old on old.members_id=d.members_id
If the members_id belongs to an old member, all fields from the member table
will be null. If it's a new member, all fields from the old member table
will be null .. That way you only need to query the database once. Then, in
your PHP/ASP code you check if id > 1000 and if it is you use the fields
from the new members table...
d.members_id, m.name, old.name
1 NULL name1
100 NULL name2
2000 name2 NULL
/torgil
> I left joined the DATA with MEMBERS and in a loop when displaying records,
> when I see that the MEMBER_ID belongs to the old member, I open another
> recordset that get's me his name from OLDMEMBERS table.
>
> I thought that this is better than the first solution because
> when my database
> grows, all of the new messages will be from new members, not old, so the
> condition to open recordset in for...next loop would not be executed.
>
> Is my thinking valid?
>
> Yours
>
> Jerry
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
> http://www.mysql.com/manual.php (the manual)
> http://lists.mysql.com/ (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
> <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php