mysql - Return NULL or Empty Values When Data Doesn't Exist -
i have query returns customer info, billing info, , stores shopped @ info. i'm joining on cust_id key each table. of jennifer's (customer) information comes fine has data in each field. have situation susan (customer) doesn't return because 1 of store_names doesn't have location. how modify query show susan if here store doesn't have location? therefore null or empty value. thank in advance..
select distinct a.first_name, a.last_name, a.customer_no,                  b.bill_type, b.bill_date, c.store_names, c.store_location                  customer                  inner join billing b                 on a.cust_id = b.cust_id                 inner join storedetail c                 on a.custid = c.custid 
it's called outer join. returns null tables out matching values.
select distinct a.first_name, a.last_name, a.customer_no,              b.bill_type, b.bill_date, c.store_names, c.store_location              customer              inner join billing b             on a.cust_id = b.cust_id             left join storedetail c             on a.custid = c.custid 
Comments
Post a Comment