The secret is to use the tags table twice, but you've got to rename them
to avoid vagueness.
select t1.tagnumbers,mem.days,mem.expdate
from tags as t1,tags as t2,membersip as mem
where t1.orderid = t2.tagid
and t1.orderid = mem.tagid
I believe that should work.
[EMAIL PROTECTED] wrote:
>Hello All,
>
>I got a sql query I seemed to be missing the obvious or just can't see.
>Database Table structure:
>CREATE TABLE `membership` (
> `tagid` int(8) NOT NULL default '0',
> `startdate` date NOT NULL default '0000-00-00',
> `expdate` date NOT NULL default '0000-00-00',
> `days` smallint(4) NOT NULL default '0',
> PRIMARY KEY (`tagid`),
> KEY `days` (`days`)
>)
>
>CREATE TABLE `tags` (
> `tagid` int(8) NOT NULL auto_increment,
> `orderid` int(8) NOT NULL default '0',
> `finderid` int(8) NOT NULL default '0',
> `tagnumber` varchar(10) NOT NULL default '',
> PRIMARY KEY (`tagid`),
> UNIQUE KEY `tagnumber` (`tagnumber`),
> KEY `orderid` (`orderid`,`finderid`)
>);
>
>What I need to do is extract all the tagnumbers,days and expdate where the
>orderid equals the tagid in both the "tags" and "membership" tables.
>
>I just can't seem to get the results I need. Any help would be much appreciated.
>
>Mysql version 3.23.40
>
>THX's
>Mike(mickalo)Blezien
>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>Thunder Rain Internet Publishing
>Providing Internet Solutions that work!
>http://www.thunder-rain.com
>Tel: 1(225)686-2002
>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>
>
>---------------------------------------------------------------------
>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