query about counting records entered in same date...
-
hi everyone .... Ive a problem to select orders count by date only Here ive table called ORDERSMAIN In this ive columns Date , Order list Here the date is along vth time wen it is entered... SO i want to count the total number of orders entered in each day .. so the date will be distinct finally ... n one of our frnd told me the answer in one topic ,in that the orders r counting by the Date with time... but i need only vth date .. how to ignore the time .... ive table like this Sno Date Orders 1 2007/3/4 02:02:02 sfjsk 2 2007/3/4 02:02:01 sfjgf 3 2007/3/4 02:02:00 szdjfdj 4 2007/3/5 02:56:02 sfsdfs finally i want to get is Date ordersCount 2007/3/4 50 2007/3/3 80 2007/3/2 90 Like this plz help Thanks inadv Naresh
-
hi everyone .... Ive a problem to select orders count by date only Here ive table called ORDERSMAIN In this ive columns Date , Order list Here the date is along vth time wen it is entered... SO i want to count the total number of orders entered in each day .. so the date will be distinct finally ... n one of our frnd told me the answer in one topic ,in that the orders r counting by the Date with time... but i need only vth date .. how to ignore the time .... ive table like this Sno Date Orders 1 2007/3/4 02:02:02 sfjsk 2 2007/3/4 02:02:01 sfjgf 3 2007/3/4 02:02:00 szdjfdj 4 2007/3/5 02:56:02 sfsdfs finally i want to get is Date ordersCount 2007/3/4 50 2007/3/3 80 2007/3/2 90 Like this plz help Thanks inadv Naresh
Hi You can convert the datetime column to specific format ('mm/dd/yyyy'). Check different formats in SQL Help online. Use the converted column in group by clause. Here is the example for you. Here I have converted to mm/dd/yyyy that is format parameter is 103. You can change it to your requirement
select convert(nvarchar(12),DTimeStamp,103) as Dsb_Time, count(*) from Table1 where DTimeStamp is not null Group by convert(nvarchar(12),DTimeStamp,103)
Hope you got itHarini
-
Hi You can convert the datetime column to specific format ('mm/dd/yyyy'). Check different formats in SQL Help online. Use the converted column in group by clause. Here is the example for you. Here I have converted to mm/dd/yyyy that is format parameter is 103. You can change it to your requirement
select convert(nvarchar(12),DTimeStamp,103) as Dsb_Time, count(*) from Table1 where DTimeStamp is not null Group by convert(nvarchar(12),DTimeStamp,103)
Hope you got itHarini
-
hi everyone .... Ive a problem to select orders count by date only Here ive table called ORDERSMAIN In this ive columns Date , Order list Here the date is along vth time wen it is entered... SO i want to count the total number of orders entered in each day .. so the date will be distinct finally ... n one of our frnd told me the answer in one topic ,in that the orders r counting by the Date with time... but i need only vth date .. how to ignore the time .... ive table like this Sno Date Orders 1 2007/3/4 02:02:02 sfjsk 2 2007/3/4 02:02:01 sfjgf 3 2007/3/4 02:02:00 szdjfdj 4 2007/3/5 02:56:02 sfsdfs finally i want to get is Date ordersCount 2007/3/4 50 2007/3/3 80 2007/3/2 90 Like this plz help Thanks inadv Naresh
You can try following SQL Statement:- Select count(orders) from orderlist group by format(date,"mm-dd-yyyy") order by format(date,"mm-dd-yyyy"). The format can even be used for grouping by months. Thanks