Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Query "Where" Clause

Status
Not open for further replies.

elentz

Technical User
Jan 9, 2007
81
US
I have two queries that I want to exclude certain records from the result. They are:

$query2 = 'update vtiger_products set unit_price = unit_price * 1.30 where productname NOT LIKE "Trip Charge %" ';

and

$query="INSERT INTO
vtiger_pricebookproductrel
( pricebookid
, productid
, listprice )
select (".$fieldvalue1.")
, productid
, (unit_price *.769) * (".$fieldvalue2.")
from vtiger_products Where productname NOT Like ('Trip Charge %')" ;

They both appear to work for the "Trip Charge" portion. How do i add another field to exclude? I need a wildcard in each exclusion. I have tried everything I could think of.

Thanks for looking
 
just add them with ANDs

Code:
Where productname NOT Like ('Trip Charge %')
AND somecolumn NOT LIKE ('something else %')
 
Hmm,

That doesn't work at all. Maybe I put the question wrong. I need to exclude both Trip charge and labor records using the same field.

$query="INSERT INTO
vtiger_pricebookproductrel
( pricebookid
, productid
, listprice )
select (".$fieldvalue1.")
, productid
, (unit_price *.769) * (".$fieldvalue2.")
from vtiger_products Where productname NOT Like ('Trip Charge %') AND ('Labor %')" ;

When I run this query it excluded neither. However when I create a Select query using the "Not Like ..." It works

Any other suggestions

Thanks
 
OK Now it works as I wanted. I needed to adjust the exclusion. I had productnames 'Trip Charge' AND Trip Charge -- City' So I had to add another Not Like 'Trip Charge' I guess I didn't realize that the wildcard was after the first Trip Charge.

Thanks for the help Guys!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top