Gossamer Forum
Home : General : Databases and SQL :

Grabbing value from a different table, based on results from current table...

Quote Reply
Grabbing value from a different table, based on results from current table...
Hi guys, I'm trying to do something like;

SELECT pmtext.pmid FROM pm WHERE pm.userid = 3312

.. but its giving me an error.

Basically, I just want to select pmtext.pmid, based on the results for "WHERE pm.userid = ...".

Anyone got any ideas? My head is really hurting today Frown

TIA

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Grabbing value from a different table, based on results from current table... In reply to
Hi,

You need to join the tables:

select pmtext.pmid
from pm, pmtext
where pm.a = pmtext.b and
pm.userid = '....';

You need to look at how the tables are joined, and fill in the a and b. =)

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Grabbing value from a different table, based on results from current table... In reply to
Thanks... worked a charm :)

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates