Fetch and match data from 2 tables?
#3
Thanks buddy for reply.

Here is what I mean. I have a table called Ads which has a column called tid right. This TID column stores tids that correspond to forum real TIDs

I would like to fetch all thread tids and then all ads tids compare them and then output Thread tids that are not in the Ads tid column.


$query = $db->query("
        SELECT t.tid
        FROM ".TABLE_PREFIX."threads t
        WHERE t.tid NOT IN (how to fetch ads tid from here)
    ");

When I fetch tids they all show like one long number. How to put a comma in the middle to use it in NOT IN expression

$query2 = $db->query("
        SELECT t.tid
        FROM ".TABLE_PREFIX."threads t
		WHERE t.tid NOT IN (SELECT a.tid
        FROM ".TABLE_PREFIX."ads a)
    ");

Is this OK to use? Looks ugly to me!
Reply


Messages In This Thread
RE: Fetch and match data from 2 tables? - by Yumi - 2015-06-12, 05:31 AM
RE: Fetch and match data from 2 tables? - by marcus123 - 2015-06-12, 12:34 PM
RE: Fetch and match data from 2 tables? - by Yumi - 2015-06-13, 10:08 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)