Alejandro,

It is helpful to think of the question this way:

select the items from the sales table
where there is no day in the month
when that item was not sold

or

select the items from the sales table
where the number of distinct days the item was sold
equals the number of days in the month

-- DaysTable has one row for each day you will consider
-- create table DaysTable ( [Date] smalldatetime primary key)
-- (insert rows into DaysTable)
select Code
from SalesTable S1
where not exists (
select [Date] from DaysTable D
where [Date] >= '20030601'
and [Date] < '20030701'
and not exists (
select * from SalesTable S2
where S2.[Date] = D.[Date]
and S2.[Code] = S1.[Code]
)
)

or

select Code from SalesTable
where [Date] >= '20030601'
and [Date] < '20030701'
group by Code
having count(distinct Date) =
datediff(day,'20030601','20030701')

If SalesTable has only one row per day for each item,
the second query does not need DISTINCT and may then
be more efficient. Otherwise the first query may be better.

Steve Kass
Drew University

Alejandro wrote:
>I have a sales table with this fields
>
>CODE PRICE QUANT DATE
>1 2,5 3 02/06/2003
>3 4 1 03/06/2003
>
>where every items saled have registered like a row in this table , i want to
>make a view , where i can filter those items
>who sales every days , example
>the code 1 items sales on day 1,2,3,4, every the days of the month in this
>posible?????
>
>
>Thanks
>
>Alejandro Carnero
>SAntos
>Brazil
>
>
>
>
>