Re: Join issue

Поиск
Список
Период
Сортировка
От
Тема Re: Join issue
Дата
Msg-id 20060607190423.67115.qmail@web33305.mail.mud.yahoo.com
обсуждение исходный текст
Ответ на Re: Join issue  ("Burak Seydioglu" <buraks78@gmail.com>)
Список pgsql-sql
> Table structures:
> 
> ce_house
> ====================
> house_id
> provider_id
> 
> ce_contract
> ====================
> contract_id
> house_id
> contract_term
> contract_created
> 
> ce_contract_status
> ====================
> contract_status_id
> contract_id
> contract_status
> contract_status_created
> 
> ce_provider
> ====================
> provider_id
> provider_name
> 
> ce_provider_rate
> ====================
> provider_rate_id
> provider_id
> provider_rate_amount
> provider_rate_created

if i'm reading this right, a house can only have one
provider, but a house can have multiple contracts.  at
first glance, i'd think the contracts should be
associated with the provider, not the house.  if true,
you need to update your table structure.

is the rate associated with the contract (i'd assume
so with limited informationthink so) or the provider
(the way you have it set up)?

this is how i envision the table structure (granted, i
have limited information so i coul dbe way off
base)...

ce_house
====================
house_id

ce_provider
====================
provider_id
** house_id (fkey) **
provider_name

ce_contract
====================
contract_id
** provider_id (fkey) **
contract_term
contract_created

ce_contract_status
====================
contract_status_id
contract_id (fkey)
contract_status
contract_status_created

** ce_contract_rate **
====================
contract_rate_id
contract_id (fkey)
contract_rate_amount
contract_rate_created

i also assume, based on your structure, that you can
have multiple contract statuses for a given contract. 
if not,you could probably delete that table and just
add contract_status and contract_status_created to
ce_contract.

i'm sorry if i'm way off base, but i'm trying to wrap
my head around the table strcuture, but i'm not
necessarily familiar with all the business rules that
created the structure - so i may be way off base here.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


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

Предыдущее
От: "Burak Seydioglu"
Дата:
Сообщение: Re: Join issue
Следующее
От:
Дата:
Сообщение: Re: How To Exclude True Values