Okay, I'm trying to create a sales history report and I'm encountering a problem I can't easily find the answer.

My SELECT statement works fine for the most part. I select from multiple tables (this is the SQL backend to a inventory/accounting software, it's Pervasive SQL) and use a couple of where clauses. It works fine until I try to do an OR at the end.

Here's the whole SQL line:
Code:
SELECT SALES_HISTORY_HEADER.IN_DATE,SALES_HISTORY_HEADER.NUMBER,SALES_HISTORY_DETAIL.WHSE,SALES_HISTORY_DETAIL.CODE,SALES_HISTORY_HEADER.CUST_NO,SALES_HISTORY_DETAIL.BVUNITPRICE,SALES_HISTORY_DETAIL.BVCMTDQTY FROM \"SALES_HISTORY_HEADER\",\"SALES_HISTORY_DETAIL\" WHERE SALES_HISTORY_DETAIL.NUMBER = SALES_HISTORY_HEADER.NUMBER AND SALES_HISTORY_DETAIL.RECNO > 0 AND SALES_HISTORY_DETAIL.CODE LIKE 'HG%' OR SALES_HISTORY_DETAIL.CODE LIKE 'HX%'
The statement is basically trying to retrieve all data that has a part code that starts with HG or HX.

Now, the problem comes at the end.
SALES_HISTORY_DETAIL.CODE LIKE 'HG%' OR SALES_HISTORY_DETAIL.CODE LIKE 'HX%'
If I remove the OR statement, it functions fine. I can get HG% titles OR HX% titles, but not both.

If I keep the LIKE statement but specify specific titles instead of wildcards, that doesn't work either.
SALES_HISTORY_DETAIL.CODE LIKE 'HGV07111906' OR SALES_HISTORY_DETAIL.CODE LIKE 'HXDA0046772'

The statement also doesn't work if I just specify two titles individually.
SALES_HISTORY_DETAIL.CODE = 'HGV07111906' OR SALES_HISTORY_DETAIL.CODE = 'HXDA0046772'

Am I just misusing the OR clause? Online it seems like people are using it to compare two separate columns, and I'm trying to use it on the same column. If that is in fact my problem, can someone point me to the correct way to select specific wildcards from the same column?

Thanks.