MySQL select with Disitinct and Where with is_null? -
can please explain mysql query & does?
as can understand following:
select invoices_charge
invoice id
’s without entry in invoice table. correct?
select distinct invoice_charges.invoiceid invoice `invoice_charges` left join `invoice` on invoice_charges.invoiceid = invoice.invoiceid invoice.invoiceid null
is there effect of keyword distinct in query? following query better alternative query achieve same result ?
select invoice_charges.invoiceid invoice `invoice_charges` invoice_charges.invoiceid not in invoice.invoiceid group invoice_charges.invoiceid
this query returning invoiceid
s in invoice_charges
have no match in invoice
.
presumably, these examples of failed foreign key relationship.
the purpose of distinct
prevent duplicates being in result set. have 2 records in invoice_charges
same invoiceid
, invoiceid
not in invoice
table.
Comments
Post a Comment