Page 1 of 1

Join table with empty data

Posted: Sun Jan 07, 2007 3:41 pm
by cesarcesar
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hello, 

I'm a novice, and am having issues get a JOIN to work properly. The following code is correct for pulling field values that HAVE a value, but when a field i am requesting has a value like Null, Space, or just empty, the whole query comes back empty.

It was suggested i use TRIM in my call, but i'm not exactly sure how to use properly.

As far as each table, the fields that are empty are set to ALLOW NULL. Thanks for the help.

[syntax="sql"]
Select
company.company_name,
company.company_username,
company.company_clients_served,
company.company_status,
note.note_text,
address.address_street1,
address.address_street2,
address.address_zip,
address.address_zip_ext,
county.county_id,
city.city_name,
taxes_states.state_id,
email.email_address,
url.url_path,
url.url_name,
company_type.company_type_id
From
company
Inner Join note ON company.note_id = note.note_id
,
address
Inner Join connector_address ON company.company_id = connector_address.ref_id AND connector_address.address_id = address.address_id
Inner Join county ON address.county_id = county.county_id
Inner Join city ON address.city_id = city.city_id
Inner Join taxes_states ON address.state_id = taxes_states.state_id
Inner Join connector_email ON company.company_id = connector_email.ref_id
Inner Join email ON connector_email.email_id = email.email_id
Inner Join connector_url ON company.company_id = connector_url.ref_id
Inner Join url ON connector_url.url_id = url.url_id
,
company_type
Inner Join connector_company ON company_type.company_type_id = connector_company.company_type AND company.company_id = connector_company.company_id
Where company.company_id = '15'

feyd | Please use[/syntax]

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Sun Jan 07, 2007 5:04 pm
by feyd
SQL questions go in Databases....

Posted: Sun Jan 07, 2007 5:11 pm
by cesarcesar
ok i will post correctly next time.

Posted: Mon Jan 08, 2007 1:13 am
by timvw
Lookup what 'outer join' can do for you..