View Single Post

  #1 (permalink)  
Old 04-20-2007
laredotornado@zipmail.com
 
Posts: n/a
Default Trouble writing a query

Hi,

I'm using MySQL 5.0. I have three tables ...

MODULES (lists available content for the page, e.g. Gmail, ESPN, CNN)
----------------
ID
NAME

TABS (lists names of groups of modules)
---------
ID
NAME

TAB_MODULES (lists modules that go in each group)
-----------------------
ID
MODULE_ID (foreign key to MODULES.ID column)
TAB_ID (foreign key to TABS.ID column)

I want to write a query that tells me whether a module is displayed on
a tab, given a tab's ID. The result set should always contain the
same number of rows as SELECT COUNT(*) FROM MODULES. I would like it
to contain

MODULE_NAME (name of module)
SELECTED (either 1 or 0)

How do I do this?

Thanks, - Dave

Reply With Quote