Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. query about counting records entered in same date...

query about counting records entered in same date...

Scheduled Pinned Locked Moved Database
helpdatabasetutorial
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nareshss
    wrote on last edited by
    #1

    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

    H S 2 Replies Last reply
    0
    • N nareshss

      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

      H Offline
      H Offline
      Harini N K
      wrote on last edited by
      #2

      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 it

      Harini

      N 1 Reply Last reply
      0
      • H Harini N K

        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 it

        Harini

        N Offline
        N Offline
        nareshss
        wrote on last edited by
        #3

        Thanqqqqqqqqqqqqqqqqqqqqqq Harini..... I am getting my result nowwwwwww.... Thats great Actually iam new to sqlserver This group is very helpfull for me .... Thanq once again.... Naresh

        1 Reply Last reply
        0
        • N nareshss

          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

          S Offline
          S Offline
          Shiv Singh Sisodiya
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups