Microsoft SQL Server 2008 R2 (between)
-
i'm trying to filter by date using query but error.
select s.IdStaff, s.NamaStaff,
sum(pd.Qty *
case s.posisi
when 'K.Teknisi' then kd.komisiteknisi
when 'K.Controller' then kd.komisitelemarketing
when 'K.Manager' then kd.komisicontroller
when 'K.TeleMarketing' then kd.komisimanager
when 'K.Cadangan' then kd.komisicadangan
end) Insentif
from staff s inner join penjualan p on s.idstaff = p.idstaff
inner join penjualandetail pd on p.idpenjualan = pd.idpenjualan
inner join komisidetail kd on pd.idbarang = kd.idbarang
where p.tglpenjualan between 12/1/2011 and 12/30/2011
group by s.idstaff, s.namastafferror message : Msg 206, Level 16, State 2, Line 1 Operand type clash: date is incompatible with int
-
i'm trying to filter by date using query but error.
select s.IdStaff, s.NamaStaff,
sum(pd.Qty *
case s.posisi
when 'K.Teknisi' then kd.komisiteknisi
when 'K.Controller' then kd.komisitelemarketing
when 'K.Manager' then kd.komisicontroller
when 'K.TeleMarketing' then kd.komisimanager
when 'K.Cadangan' then kd.komisicadangan
end) Insentif
from staff s inner join penjualan p on s.idstaff = p.idstaff
inner join penjualandetail pd on p.idpenjualan = pd.idpenjualan
inner join komisidetail kd on pd.idbarang = kd.idbarang
where p.tglpenjualan between 12/1/2011 and 12/30/2011
group by s.idstaff, s.namastafferror message : Msg 206, Level 16, State 2, Line 1 Operand type clash: date is incompatible with int
Use quotes around the dates and check that the format of the dates is valid.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair. nils illegitimus carborundum me, me, me
-
Use quotes around the dates and check that the format of the dates is valid.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair. nils illegitimus carborundum me, me, me
-
perfect !! wondering why i always forgot that even after my teacher told me twice. how about the date format? is it YYYY/MM/DD or MM/DD/YYYY or else? thanks before.. :laugh:
vkstarry wrote:
how about the date format?
is it YYYY/MM/DD or MM/DD/YYYY or else?thatraja
My Dad had a Heart Attack on this day so don't...
Pompeyboy3 here | Nobody remains a virgin, Life screws everyone :sigh: -
perfect !! wondering why i always forgot that even after my teacher told me twice. how about the date format? is it YYYY/MM/DD or MM/DD/YYYY or else? thanks before.. :laugh: