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 invoiceids 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

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -