cesarcesar Posted January 7, 2007 Share Posted January 7, 2007 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.[code=php:0]Selectcompany.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_idFromcompanyInner Join note ON company.note_id = note.note_id,addressInner Join connector_address ON company.company_id = connector_address.ref_id AND connector_address.address_id = address.address_idInner Join county ON address.county_id = county.county_idInner Join city ON address.city_id = city.city_idInner Join taxes_states ON address.state_id = taxes_states.state_idInner Join connector_email ON company.company_id = connector_email.ref_idInner Join email ON connector_email.email_id = email.email_idInner Join connector_url ON company.company_id = connector_url.ref_idInner Join url ON connector_url.url_id = url.url_id,company_typeInner Join connector_company ON company_type.company_type_id = connector_company.company_type AND company.company_id = connector_company.company_idWhere company.company_id = '15'[/code] Link to comment https://forums.phpfreaks.com/topic/33247-join-table-with-empty-data/ Share on other sites More sharing options...
magic2goodil Posted January 7, 2007 Share Posted January 7, 2007 fix your code layout and repost that please...it's too much of a mess to understandalso around each field i suggest `` those are above the tab key..and around any values you are putting behind where =, put ' ' around them.. Link to comment https://forums.phpfreaks.com/topic/33247-join-table-with-empty-data/#findComment-155239 Share on other sites More sharing options...
cesarcesar Posted January 7, 2007 Author Share Posted January 7, 2007 my code is not readable? Each select is on a separate line, each join is on a separate line. i thought this would be the most easiest to read.Do i put `` around statements like, [code]company.company_id = `connector_url.ref_id`[/code]? Im sure this is not the fix though. I have not used `` in my code (noobie error, i will change), and code has worked fine. Link to comment https://forums.phpfreaks.com/topic/33247-join-table-with-empty-data/#findComment-155257 Share on other sites More sharing options...
magic2goodil Posted January 7, 2007 Share Posted January 7, 2007 it would be like this[code]select `company.company_id` from company where `company.note_id` = 'value'[/code]not sure this is one for me to answer though because i am not sure what Inner JOIN does Link to comment https://forums.phpfreaks.com/topic/33247-join-table-with-empty-data/#findComment-155267 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.