SQL Query to get rows from today

I get in this database everyday orders but i only want to see the orders for today.
__
SELECT     tblRelatie.fldRelatiecode, tblVerkoopOrder.fldOrdernummer, tblArtikel.fldArtikelcode, tblArtikel.fldOmschrijving, tblVerkoopOrder.fldOmschrijving AS Expr1,
                      tblRelatie.fldNaam, tblVerkoopOrder.fldAfhandelStatus, tblVerkoopOrder.fldWerkbonAfgedrukt, tblVerkoopOrder.fldOfferteAfgedrukt, tblVerkoopOrder.fldPakbonAfgedrukt,
                      tblVerkoopOrder.fldAfhaalbonAfgedrukt, tblVerkoopOrder.fldDatum
FROM         tblVerkoopOrder INNER JOIN
                      tblVerkoopOrderRegel ON tblVerkoopOrder.fldVerkoopOrderID = tblVerkoopOrderRegel.fldVerkoopOrderID INNER JOIN
                      tblArtikel ON tblVerkoopOrderRegel.fldArtikelID = tblArtikel.fldArtikelID INNER JOIN
                      tblRelatie ON tblVerkoopOrder.fldRelatieID = tblRelatie.fldRelatieID
                     
                 
ORDER BY tblVerkoopOrder.fldNaam, tblVerkoopOrder.fldDatum
__
tblVerkoopOrder.fldDatum has to be the date for today

Thanks in advance

Danny
LVL 6
Danny KonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

 
Vitor MontalvãoMSSQL Senior EngineerCommented:
Just add the criteria for today date by converting the date returned by GETDATE in date only so you can have the beginning of the day and do the same by adding a day to GETDATE so you'll have the upper limit:
SELECT     tblRelatie.fldRelatiecode, tblVerkoopOrder.fldOrdernummer, tblArtikel.fldArtikelcode, tblArtikel.fldOmschrijving, tblVerkoopOrder.fldOmschrijving AS Expr1, 
                       tblRelatie.fldNaam, tblVerkoopOrder.fldAfhandelStatus, tblVerkoopOrder.fldWerkbonAfgedrukt, tblVerkoopOrder.fldOfferteAfgedrukt, tblVerkoopOrder.fldPakbonAfgedrukt, 
                       tblVerkoopOrder.fldAfhaalbonAfgedrukt, tblVerkoopOrder.fldDatum
 FROM         tblVerkoopOrder INNER JOIN
                       tblVerkoopOrderRegel ON tblVerkoopOrder.fldVerkoopOrderID = tblVerkoopOrderRegel.fldVerkoopOrderID INNER JOIN
                       tblArtikel ON tblVerkoopOrderRegel.fldArtikelID = tblArtikel.fldArtikelID INNER JOIN
                       tblRelatie ON tblVerkoopOrder.fldRelatieID = tblRelatie.fldRelatieID               
 WHERE tblVerkoopOrder.fldDatum >= CAST(GETDATE() AS DATE) AND tblVerkoopOrder.fldDatum < CAST(GETDATE()+1 AS DATE)
 ORDER BY tblVerkoopOrder.fldNaam, tblVerkoopOrder.fldDatum

Open in new window

0

Experts Exchange Solution brought to you by ConnectWise

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
 
Danny KonAuthor Commented:
Vitor,

Thanks that was what i needed
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.