Complex Query Help- For Me, Anyway

Поиск
Список
Период
Сортировка
От
Тема Complex Query Help- For Me, Anyway
Дата
Msg-id 20051227182944.85621.qmail@web33305.mail.mud.yahoo.com
обсуждение исходный текст
Ответы Re: Complex Query Help- For Me, Anyway  ("Keith Worthington" <keithw@narrowpathinc.com>)
Список pgsql-novice
i'm having a problem sorting out a query - the biggest
problem is that i'm not wrapping my mind around the
thought process required to solve the issue (hint -
step by step thought process guidance is what is
really important to me, not so much the answer - i
want to be able to address this situation next time,
too).

the table structure (shortened for brevity):

t_sn
link_id
serial_number

t_link
link_id
job_number_id
contract_id

t_job_number
job_number_id
product_id

t_product
product_id
product_number

the links:

t_sn.link_id <-> t_link.link_id
t_link.job_number_id <-> t_job_number.job_number_id
t_job_number.product_id <-> t_product.product_id

i'm trying to create an array a multidimensional array
of all serial numbers by product number.  for example:

prod1
sn1
sn2
sn3

prod2
sn4
sn5
sn6

this allows my user to choose a product and then view
a select box populated with only the associated serial
numbers.

i *think* i'm trying to find product_id,
product_number, sn_id, serial_number where the
t_sn.link_id = t_link.link_id AND t_link.job_number_id
= t_job_number.job_number_id AND
t_job_number.product_id = t_product.product_id.

i receive the following error:

ERROR:  missing FROM-clause entry for table "t_link"

the last time i saw this error, a few people pointed
me to the solution of using a subquery.

excluding this error, i'm thinking i'm wrong b/c i
don't see how the above "logic" can produce multiple
serial number results.

i'm not grasping what my thought process should be
when i view this situation.

any help is greatly appreciated.



__________________________________________
Yahoo! DSL – Something to write home about.
Just $16.99/mo. or less.
dsl.yahoo.com


В списке pgsql-novice по дате отправления:

Предыдущее
От: Ramon Orticio
Дата:
Сообщение: Re: 2 Questions
Следующее
От: "Keith Worthington"
Дата:
Сообщение: Re: Complex Query Help- For Me, Anyway