|
Posted by DonJ on 10/20/05 09:51
I get as a result:
variable_value NULL
variable_id NULL
variable_name NULL
company_name samplecompany
eventhough I have like 3 variables in variable_name
So I would like the following (if variable_value would be empty):
variable_value NULL
variable_id 1
variable_name sampplevar1
company_name samplecompany
variable_value NULL
variable_id 2
variable_name sampplevar2
company_name samplecompany
variable_value NULL
variable_id 3
variable_name sampplevar3
company_name samplecompany
Thx for your help.
Stefan Rybacki schrieb:
> dickgiesser@gmail.com wrote:
> > Hi,
> >
> > I have the following situation:
> >
> > 3 tables:
> >
> > Table: variable_value
> > variable_id int(11)
> > company_id int(11)
> > variable_value varchar(255)
> >
> > Table: variable
> > variable_id int(11)
> > variable_name varchar(255)
> >
> > Table: company
> > company_id int(11)
> > company_name varchar(255)
> >
> > I store variables in the variable tables and companies in the company
> > table. I want to assign a different value to each variable for each
> > company. Now I need a select that will show me all variables of a
> > company if they are in the variable_value table yet or not.
> >
> > I came this far, but this isn't what I need, since it does not show all
> > variables:
> > Select variable_value, variable.variable_id, variable_name,
> > company_name FROM company
> > LEFT JOIN variable_value ON variable_value.company_id =
> > company.company_id
> > LEFT JOIN variable ON variable.variable_id = variable_value.variable_id
> > WHERE company_id = ??
> >
>
> Why is that not what you want and what does this query show and what do you expect, and
> why does your subject contain inner join even if you're using outer joins?
>
> Regards
> Stefan
>
> > Anyone got an idea?
> >
> > Thx alot
> >
Navigation:
[Reply to this message]
|