How to write a script that will display records in the "date" format

  • Hello Sir, Madam

    How are you doing? My name is Joe and this is my first time to use this service to ask questions which relate to SQL Server 2005. I don’t know where to post my question, so I decide to come here and email you. If this is a wrong place to post the question, please guide me to know where I should go to post for question on your site and view the question that I have been posted.

    My question is: If I have a table which has only one column, it contains “Date” only and each date cell of the column represents number of records that have been entered into the database. If I wish to write code to pull out and count the number of records have been entered the database for each week and showing the total number of records show at the bottom of all weeks.

    This is my script that I have written but It won't give me what I wish to show.

    Select Count(ClearedDate) As 'Total Cleared'

    from DEClearedDate

    Where (Datepart(dw,ClearedDate)>=1) And (Datepart(dw,ClearedDate)<=6)

    Since I want to count the number of records from Saturday to Friday of every week have been entered and showing the total cases in the database. it shows me the number of cases for week one only and it skips the repeated date (but I wish to count every cell in the column) and skips federal holiday and it won't show me the total cases in the database.

    Thank You Very Much

    Joe

  • Hi Joe,

    I don't understand what you want. Do you want to count the dates by week or by weekday?

    Alexander

  • Oh where to start.

    First. Do not create new threads with the same question in them. It splits replies, confuses things and just generally annoys people.

    Second. You still have not posted the data requested of you numerous times. We've asked for sample data and given you a thread explaining how to post it. You have not posted sample data. You've posted a list of dates that we'd have to modify heavily to use. That work should fall on you, not on us.

    Third. You never even responded to Chris' last attempted solution. Don't see it? You'd have to look in your other identical thread. (See how annoying that is).

    As Jeff mentioned... in your other thread... if you don't help us, we're not nearly as likely to help you.

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply