ciao a tutti, probabilmente sono fuso, ma sta query non mi viene...
non da errore ma non ho il risultato che cerco.
in sostanza ho 2 tabelle (customers e orders) quello che non funziona è la condizione dopo AND.codice:SELECT customers.id,customers.first_name,customers.email FROM customers LEFT OUTER JOIN orders ON customers.id=orders.customer_id WHERE customers.custfields LIKE '%"&cs1&"%' OR customers.custfields LIKE '%"&cs2&"%' AND (orders.billing_notes NOT LIKE '%-" & cs1 & "-%' OR orders.billing_notes NOT LIKE '%-" & cs2 & "-%' OR orders.shipping_notes NOT LIKE '%-" & cs1 & "-%' OR orders.shipping_notes NOT LIKE '%-" & cs2 & "-%')
come risultato devo ottenere tutti i campi dentro customers a patto che nella riga corrispondente dentro la tab orders NON ci sia il pattern indicato (cs1 o cs2) nei campi indicati.![]()

Rispondi quotando
