Link to home
Start Free TrialLog in
Avatar of Thomas Stockbruegger
Thomas StockbrueggerFlag for Germany

asked on

Need some help with DATEPART DATEDIFF

sql.Format("SELECT DATEPART(year,A.Lieferscheindatum)AS year,\
                                 DATEPART(month,A.Lieferscheindatum)AS month,\
                                 SUM(B.Einheitbez13wert)AS Gewicht\
                                 FROM Lieferscheine AS A , Lieferscheinpositionen AS B\
                                 WHERE A.LieferscheinNr=B.LieferscheinNr AND A.LieferscheinNr<200000\
                                 GROUP BY DATEPART(month,A.Lieferscheindatum),\
                               DATEPART(year,A.Lieferscheindatum)\
                               ORDER by DATEPART(year,A.Lieferscheindatum)ASC,\
                               DATEPART(month,A.Lieferscheindatum)ASC");

Hello,
I just want to get values of my SQL Table starting May 2006 till today.
How can I do this, please help.
Thank you.
Best regards,
Thomas
Avatar of Om Prakash
Om Prakash
Flag of India image

Try:
select * from table_name where your_date_field >= '5/1/2006'
Avatar of Thomas Stockbruegger

ASKER

sql.Format("SELECT DATEPART(year,A.Lieferscheindatum)AS year,\
                                 DATEPART(month,A.Lieferscheindatum)AS month,\
                                 SUM(B.Einheitbez13wert)AS Gewicht\
                                 FROM Lieferscheine AS A , Lieferscheinpositionen AS B\
                                 WHERE A.LieferscheinNr=B.LieferscheinNr AND A.LieferscheinNr<200000\
AND WHERE A.LIeferscheindatum>='1.5.2006'\
                                 GROUP BY DATEPART(month,A.Lieferscheindatum),\
                               DATEPART(year,A.Lieferscheindatum)\
                               ORDER by DATEPART(year,A.Lieferscheindatum)ASC,\
                               DATEPART(month,A.Lieferscheindatum)ASC");


Will not work error
ASKER CERTIFIED SOLUTION
Avatar of PortletPaul
PortletPaul
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thank you ..... very much that will work
Best regards,
Thomas