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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with a Select statement 1

Status
Not open for further replies.

Bennie47250

Programmer
Nov 8, 2001
515
US
Using Crystal 7.0 on a MS SQL table

Not getting the desired results from this select statement, I’m getting records that are out of the Invoice_date range and Order_Type.

I’m sure it needs some parentheses but I’m not sure where to put them.

Thanks

{Table2.Invoice_Date} in {?BeginDate} to {?EndDate} and
{Table2.Order_Type} like "N*" and
{Table1.Sales_Region} <> 98 and
({Table2.ItemType} = "P" and {Table2.Product_#} = "M140024")
or ({Table2.ItemType} = "L" and {Table2.Product_#} like "MCHW*")
or ({Table2.ItemType} = "P" and {Table2.Product_#} = "M140044")
or ({Table2.ItemType}= "P" and {Table2.Product_#} = "M140044DS")
 
You need to wrap this bit in ()

(
({Table2.ItemType} = "P" and {Table2.Product_#} = "M140024")
or ({Table2.ItemType} = "L" and {Table2.Product_#} like "MCHW*")
or ({Table2.ItemType} = "P" and {Table2.Product_#} = "M140044")
or ({Table2.ItemType}= "P" and {Table2.Product_#} = "M140044DS")
)

Ian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top