Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 SQL Statement to select records that don't match criteria.

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-06-23 : 10:35:56
Shaun writes "I'm trying to open 2 recordsets one that only selects products that are on sale, this is the statement:

"SELECT * FROM PRODUCTS WHERE (CLASS_ID = " & lngClassID & ") AND (ACTIVE = " & blnTrue & ") AND (SALE_START <= #" & dateCurrent & "# AND SALE_END >= #" & dateCurrent & "#) ORDER BY NAME ASC;"

This works fine, however I need to open another recordset that gets the rest of the products that are not on sale and the fields 'ACTIVE' and 'FEATURED' must be True, and the 'CLASS_ID' must be equal to lngClassID.

What would be a simple solution to this problem?

Thanks,

Shaun"

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2004-06-23 : 10:51:58
use a union and check that SALE_START and SALE_END are not between your dates...
Go to Top of Page
   

- Advertisement -