I need a query that selects the amount of records for each day in a table.

I need a query that selects the amount of records for each
day in a table.
Eg the result would be:
date 1 14
date 2 3
etc
Any ideas?

sorted:
SELECT count([commentID]),convert(varchar, dateAdded, 112)
FROM COMMENTSgroup by convert(varchar, dateAdded,
112)

Similar Messages

  • I need a query that returns the average amount of characters for a text colum in MS SQL.

    I need a query that returns the average amount of characters
    for a text colum in MS SQL.
    Could someone show me how?

    Sorted, i need the
    DATALENGTH
    function

  • Need Sql Query that Suppress the repeating rows.

    Hi Sir,
    I have below data set.
    DeptID  Sum(SAL) Avg(Sal)
      10      1300      1300
      10      2450      1300
      10      5000      1300
      20      800        800
      20      1100      800
      20      2975      800
      20      3000      800
      30      800        800
      30      1100      800
      30      2975      800
      40      3000      800
      40      4000      900
    I Need  SQL query that can remove the duplicate or suppress.Just like below data set.
    Output:
    DeptID  Sum(SAL) Avg(Sal)
      10      1300      1300
                2450      1300
                5000      1300
      20       800        800
                1100      800
                2975      800
                3000      800
                800        800
      30      1100      800
                2975      800
      40      3000      800
               4000      900
    Could you please help me on this..

    Your requiremnt is more of a reporting request which should not be handled in SQL. For example in SQL Plus you can use the BREAK command
    SQL> break on deptno
    SQL> select deptno, ename from emp order by deptno;
        DEPTNO ENAME
            10 KING
               CLARK
            20 JONES
               SCOTT
               SMITH
               ADAMS
            30 TURNER
               MARTIN
               WARD
               ALLEN
               BLAKE
    11 rows selected.
    SQL>
    But if you still wish to do it in SQL you can use ROW_NUMBER analytic function and achieve it like this
    select decode(rno, 1, deptno) deptno
         , ename
      from (
              select row_number() over(partition by deptno order by ename) rno
                   , deptno
                   , ename
                from emp

  • Query to find the latest two transactions for each Group

    Hi All,
    Consider the following sets of records in a table test.
    Group---Tran_Dt---SlNo
    c1 10/10/2003 1
    c1 10/10/2003 2
    c1 10/10/2003 3
    c1 11/10/2003 1
    c2 10/10/2003 1
    c2 10/10/2003 2
    c2 11/10/2003 1
    c2 11/10/2003 2
    c2 11/10/2003 3
    c3 10/10/2003 1
    c3 10/10/2003 2
    c3 10/10/2003 3
    I want to list out the latest two transactions for each group irrespective of the slno and trans_dt as below:
    group tran_dt SlNo
    c1 11/10/2003 1
    c1 10/10/2003 3
    c2 11/10/2003 3
    c2 11/10/2003 2
    c3 10/10/2003 3
    c3 10/10/2003 2
    Any help on this would be appreciated.
    Thanks
    Walter Nicholas T

    Hi Walter,
    Please try following query.
    select Group,tran_dt,sino from
    select Group,tran_dt,sino,(DENSE_RANK()OVER (PARTITION BY Group ORDER BY tran_dt desc,sino desc)) rank from test
    ) where rank between 1 and 2
    Thanks,
    Samir

  • Is there any way to increase the amount of space for all day events?

    I have iCal on my ipad and my phone, and when I look at the daily view or weekly view, only 1 1/2 lines are shown. If I have a few events that are all day (I keep several calendars) then I have to scroll through them one at a time. And with my fingers, sometimes they go by too fast. Does anyone know how to increase the amount of space? I am using an iPad3, and an iPhone 5, both with ios 7.
    Thank you!

    With Mac OS X, there is no way for you to alter the amount of real memory a program is allocated. This is all done dynamically by the OS. OS X's virtual memory management is far better than 'ole OS 9's.
    What are saying about a memory leak? I take it that Safari is continually using more and more memory. How much memory is it usually taking up after a few hours? Perhaps you should just quit and restart Safari every few hours before it begins failing to respond.

  • Need hierarchical chart that support multi-parent multi-child for each node

    I'm looking for a charting solution to display the parent-child relationships between jobs in our job schedule. A given job may have 0 or more parent jobs and may have 0 or more child jobs. Similar to org chart but allowing child node(s) to link to more than 1 parent node. Any ideas...?

    Correct; our job scheduler is InControl and I can pull the schedule data from there into our database for reporting. Ultimately my goal is to get the data from InControl into our database for reporting/visualization, and build an Apex application that will allow us to make changes to the schedule (add/remove/modify jobs and their dependencies) and then generate a report to serve as the job documentation for our team and for the schedulers to make the corresponding changes in InControl, and so the data center operators have up-to-date information for overnight support in the event of job failures. It's just that visualization piece that seems elusive, the rest is just writing queries designing the app, writing the report, etc.

  • Query to find the top ranked  student in each class ?? table given

    i/p table:
    studentid classid marks
    1 1 400
    2 1 500
    3 2 600
    4 2 700
    5 3 800
    6 3 900
    o/p table :
    studentid classid marks
    2 1 500
    4 2 700
    6 3 900

    You dump your homework in a forum of volunteers without even trying to resolve it, and now you start flaming in your very first thread?
    Please find assistance elsewhere, where they are more tolerant to the lazy-ones.
    Sybrand Bakker
    Senior Oracle DBA

  • Limiting the amount of records or pages that gets generated by a report

    Post Author: jjurroz
    CA Forum: General
    Hey guys,I'm using CR 8.5.3I have a quick question that hopefully one of your can help me out with. I have a report that works perfectly and uses a couple different parameters for sorting etc.. I'm using an SQL database and for a particular report, after inputting the correct parameter values the report would generate for example 12,000 records on 2000 pages. What I'm trying to do is create a new parameter that would limit either the amount of pages that gets generated or the amount of records. I think I'd rather limit the amount of records to start off with and I would like it to be from a list of predefined amounts. I.E. "ALL", "First 10", "First 50". Essentially I'm trying to create a report that gives me a subset or sample of the main report so that it could get printed to pdf and sent to customer for review. Any help would be greatly appreciated! Regards,Jose

    Post Author: jjurroz
    CA Forum: General
    I can only go to 'TopN/Sort Group Expert' menu option if I add a summary field, otherwise the option is greyed out. If I do add a summary field and go to 'TopN/Sort Group Expert' I have no formula button. I can select TopN from a drop down but then I have to hard code the N value. I'm start to wonder whether its even possible to do it dynamically in CR 8.5.   V361:Sorry JJurroz, Here again I have CR XI, so not sure if 8 will do this.  Create a number parameter {? Top_N} then go to Group Sort Expert, you should be able to click on the formula button for Top N and put your parameter {? Top_N} in the formula.
    That should work.

  • How come my macbook air has so little space. I deleted everything that I don't need and everything that has the most space I'm told NOT to delete. Everything I find is in either KB or very low MB.

    How come my macbook air has so little space. I deleted everything that I don't need and everything that has the most space I'm told NOT to delete. Everything I find is in either KB or very low MB.

    Check what is in your SSD/ storage on your macbook  Apple Icon >   about this mac > more info >  STORAGE tab on top
    recommend handy useful APPS such as :
    Disk Expert
    https://itunes.apple.com/us/app/disk-expert/id488920185?mt=12
    Disk Map
    https://itunes.apple.com/us/app/disk-map/id715464874?mt=12
    dont need them, but theyre very useful.
    also the best is DAISY DISK
    https://itunes.apple.com/app/daisydisk/id411643860?mt=12&ign-mpt=uo%3D4
    See here for answer about the OTHER which is taking up space:
    http://pondini.org/TM/30.html
    and here:
    http://pondini.org/OSX/DiskSpace.html
    See Kappys excellent note on the rest of “other” files taking up your space:
    What is "Other" and What Can I Do About It?
    see here:
    Your Solid State Drive and having enough space inside your Macbook Air & Pro
    Solid State Drive usage premise, or the “more space / upgrade SSD” question
    There have been questions posed and positions taken by many people who are trying to use their Macbook Air or Pro’s solid state drive (SSD) as a mass media storage device, for either pictures, videos, massive music collections or all three combined; but this should not be the working premise of a ‘limited’ SSD and its use.
    In which, it’s the case of those users with either 128GB, 256GB, or even 512GB of internal SSD space, that have or are running “out of space”, that questions are raised. The immediate premise of some users can sometimes be “(how to / if) upgrading my SSD” when in fact in nearly all instances another approach is the logical and sensible one that needs to be looked into and exercised.
    Any Macbook containing a SSD should be idealized as a ‘working platform’ notebook containing all your applications, documents, and weekly or bi-weekly necessary files. All collections of media files such as pictures, music, and videos, unless directly needed should be kept off the notebook and on an external hard drive or likewise. While the ‘working platform’ premise is also the case with larger internal conventional hard drives of 1TB+, its implementation isn't as critical except in terms of data protection.
    Realistically, you should at most coordinate roughly 20 to 25% of your total SSD space to all audio-video personal use media (picture / music / video collections), leaving the remaining amount on an external HD.
    Nobody should consider any notebook a data storage device at any time under any circumstance, rather a data creation, sending, and manipulation device; and in the case of a SSD, this is more important for purposes of having sufficient working space on the SSD and reducing SSD ‘bloat’ in which cases someone is wrongly attempting to use the SSD space as a large media storage nexus.
    The rare exception to the collective usage and premise of SSD use in which a much larger SSD is truly needed are for those in video and photography professions that require both the extremely fast speeds of the SSD and the onboard storage for large and or many video and photography files. However this also falls under the premise of a ‘working platform’ for such peoples rather than the intent of many who are using the SSD as passive and static data storage for media files very infrequently needed or accessed.
    All on-notebook data collections should be logically approached as to necessity, and evaluated as to whether it is active or passive data that likely doesn’t need to be on the notebook, allocations of space-percentages to as-needed work and use, apportioning space for your entertainment media, and questioning whether it should it be on the notebook for more than short-term consumption.
    Considerations should be made in the mind of any user in differentiating the necessary system data (System hub) comprising the Mac OSX, applications, necessary documents that both must and should be on your internal SSD, and that of the users personal data (Data hub) comprising created files, pictures, music, videos, PDF files, data created or being created and otherwise, that likely unless being used soon or often should be parked on an external hard drive for consumption, or temporarily loading onto the internal SSD.
    You both can and should purchase whichever SSD size you need or see fit, but even in the case of the largest of SSD, unless use-considerations are made, and SSD spaces are allocated as should be the case indicated above, one can easily and immediately run into this quandary of “needing more internal SSD space”, in which instance a different approach in usage must then be implemented.
    However it is almost always the case, that such large media files are wanted to be stored internally rather than actually needed, in which case the external HD is both prudent as well as necessary. Additionally costs per MB are infinitely less on an external HD than an internal SSD in any consideration of data expansion needs.
    A Professional Example
    In the case of a Macbook Air or Macbook Pro Retina with ‘limited’ storage on the SSD, this distinction becomes more important in that in an ever rapidly increasing file-size world, you keep vital large media files, pics, video, PDF collections, music off your SSD and archived on external storage, for sake of the necessary room for your system to have free space to operate, store future applications and general workspace. 
    You should also never be put in the position of considering “deleting things” on your Macbook SSD in order to ‘make space’. This is especially what your external HD is for.
    Professionals who create and import very large amounts of data have almost no change in the available space on their notebooks internal SSD because they are constantly archiving data to arrays of external or networked HD.
    Or in the case of the consumer this means you keep folders for large imported or created data and you ritually offload and archive this data for safekeeping, not only to safeguard the data in case your Macbook has a SSD crash, or gets stolen, but importantly in keeping the ‘breathing room’ open for your notebook to operate, expand, create files, add applications, for your APPS to create temp files, and for general operation.
    Slim USB3 1TB external hard drive
    External Hard Drives
    External hard drives are both extremely cheap and regardless of the size of your internal SSD (or even internal hard drive if the case), you need an external hard drive with your SSD equipped Macbook for several reasons:
    1. Data backup and protection.
    2. Redundancy for important data.
    3. Necessitated ideal space for large media files for collections of pictures, videos, and music etc.
    While ever changing in price, typical portable 2.5” external hard drives in USB3 run roughly $65 for 1TB or $120 for 2TB small portable USB3 hard drives. Such drives range in thickness between 5mm and 15mm, with recent improvements in storage of 500GB drives in 5mm profiles.
    There is almost no premise in which a small 12mm thick 1 Terabyte USB hard drive cannot be taken along with any Macbook as an external large storage extension inside any Macbook carry case or pouch. Typically such external HD profiles are not much bigger than a deck of cards.
    External hard drives are a foregone necessity for purchase with any Macbook for at the very least Time Machine backups, data redundancies, and ideally for large media storage.

  • Query for seeing the amount of archive switchs per day

    Hi
    I want a query for seeing the amount of archive switchs per day.
    Example:
    date & amount
    17/01/2009 40
    18/01/2009 33
    19/01/2009 45
    Thanks

    Hi friend Jamsher
    I tested in a RAC database and the result is null....
    SQL> SELECT ROUND(AVG(1440 * (b.first_time - a.first_time)), 0) "Log switch
    2 time - minutes"
    3 FROM v$loghist a, v$log b
    4 WHERE b.sequence# = a.sequence# + 1
    5 AND a.sequence# = (SELECT MAX(sequence#) FROM v$loghist)
    6 ORDER BY a.sequence#;
    Log switch
    time - minutes
    SQL>
    Thanks

  • I need a script that copies the filename into the file

    I need a script that copies the filename into 4th column of each line in the text doc file.
    I have over 2000 different file names each containing 6 columns and ~50-100 rows.
    I can do this manually using this script:
    awk '{print $1"\t"$2"t\"$3"\t <name> \t"$6}'
    But I would like an automation command or script. Is there any command that I can use instead of <name> that will copy the filename into the column?
    Thanks
    Monica

    Oops, I forgot the redirect to a file. It's not a good idea to edit files in place. A script could fail and you're left with at least one file ruined. It's better to create new files then delete the old files.
    for file in *; do
        while read col1 col2 col3 col4 col5 col6; do              
            printf "%s\t%s\t%s\t%s\t%s\n" $col1 $col2 $col3 $file $col6
        done < $file > n$file
    done
    You could narrow the files listed such as
    for file in *.tsv
    and redirect the new files to another directory. Such as
    done < $file > /absolute/path/to/directory/$file

  • Functionality that select the current tag

    I am trying to add functionality that selects the current
    tag. Like the tag editor does, but without the pop-up. I haven't
    got vary far on figuring it out and I would appriciate some help.

    What do you mean by the "current" tag? To me, that means the
    one that is
    already (i.e. currently) selected.
    Randy
    > I am trying to add functionality that selects the
    current tag. Like the tag editor does, but without the pop-up. I
    haven't got vary far on figuring it out and I would appriciate some
    help.

  • I need sorting VI that returns the sorted array element's positions in the unsorted array

    I need a VI that will very quickly (n log n) sort a 1D array of doubles.  This VI should not only output the sorted array, but for each of the sorted array elements, it should also output that sorted array element's position in the unsorted array.  So for example if the input array were:
    unsorted_array
    4.1
    2.3
    7.0
    5.6
    10.2
    Then the output arrays would be:
    sorted_array
    2.3
    4.1
    5.6
    7.0
    10.2
    indices_array
    1 (the value 2.3 is located at position 1 in the unsorted_array)
    0 (the value 4.1 is located at position 0 in the unsorted_array)
    3 (the value 5.6 is located at position 3 in the unsorted_array)
    2 (the value 7.0 is located at position 2 in the unsorted_array)
    4 (the value 10.2 is located at position 4 in the unsorted_array)
    This way I could generate the sorted_array using just the indices_array and the unsorted_array.  Has anyone written a nifty piece of code to do this?  I did some research on (n log n) sorting algorithms but most of them use recursion which I don't know how to do in LabVIEW.  It would also be nice to have an algorithm like this that could sort an array of strings.
    cheers,
    Richard

    Try something like the attached example (LabVIEW 7.0). I think it does what you need.
    (To understand the code, it is important to know that arrays of clusters are sorted by the first element in the cluster).
    Sort array itself sorts also array of strings, so you could just substitute, keeping the rest of the code the same.
    Sort array uses a variation of quicksort, so it should have about NlogN complexity.
    (If you think you only need the array of indices to later generate the sorted array, it does not make much sense to even do it. To get the indices, you need to sort the array anyway. You should just sort the plain array directly.
    Message Edited by altenbach on 07-13-2005 03:47 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    SortAndIndex.vi ‏26 KB

  • Creating a query that provides a default transaction type for those transactions not categorized?

    How could I create a query that provides a default transaction type for those transactions not categorized?
    So assuming I have:
    * Transactions table (with transactions)
    * Categories table
    * transactions_categories table - allows to allocate multiple categories (with a percentage)
     - tranactionID
     - categoryID
     - percentageAllocation
    * Usage is such that only non-personal categories have been applied through out data.  So there is a lot of transactions with no categories applied
    Aim:
    * Want to create a query that creates a list of all the allocated amounts, so would include as columns:  transaction.tDate, transaction.tTitle, categories.name, allocatedAmount(calculated from percentage * transaction amount)
    BUT:
    * How could I include in the query, the entries that cover all transaction that haven't been allocated, to a default category "personal", where the allocated Amount would be 100% of the transaction value
    * And also (if it were possible), for transactions that have been categorized but not for the complete transaction value (say only 50% was allocated to a category), how to to cover this off to.  

    To default the value of the category:
    select IIf(IsNull(Category),"Personal",Category) as Category,IIf(IsNull(Category),"100%",PercentageAllocation
    ) as PercentageAllocation from [yourtable]
    What do you want to put the values of these ones:
    And also (if it were possible), for transactions that have been categorized but not for the complete transaction
    value (say only 50% was allocated to a category), how to to cover this off to.  
    Fouad Roumieh

  • Hi all, i'm new and facing a problem while creating a new file for Xcode. I can't select the box "with XIB for user interface" if the subclass is "UIViewController".this problem happen after i upgrade Xcode to 4.6 version.Appreciate for any help rendered.

    Hi all, i'm new to Mac book & Xcode. I'm learning and facing problems while creating a new file for Xcode. Before i upgrade the software, i have no issue to create simple steps in apps. After upgrade Xcode to 4.6 version, i'm facing lot's of issue eg.
    1) "the identity "iphone developer" doesn't match any valid certificate/ private key pair",
    2) can't select the box "with XIB for user interface" if the subclass is "UIViewController"..
    Appreciate for any help rendered.

    Mikko777 wrote:So what is the best?
    I wouldn't judge. I've been to Arch for a week, you know? But as said, it's VERY close to it.
    What I dislike after a week is makepkg not handling dependencies automatically (which would be overhead, so probably not appropriate).
    Mikko777 wrote:Also theres KDEmod for modular kde, dunno if its for 64 bits tho.
    Don't actually need that as said ... I see no real benefit of having that other than not beeing a KDE user or having Gentoos useflags.
    Mikko777 wrote:PS:You produce a lot of text and welcome smile
    Yeah. Wonder why I'm still employed? So do I ...

Maybe you are looking for

  • Creation of catalogue file.BAPI to FILE scenario.

    hi, I am currently working on a RFC to file scenario. The requirment says a catalogue file needs to be created at target.Please tell me what a catalogue file is?how is it created?

  • BlackBerry Desktop won't start!

    I have tried anything I can think of to open the desktop software and just get the same message, "BlackBerry Desktop Software has encountered a problem and needs to close." I can open device manager just fine, but not the desktop, even after I downlo

  • ODBC error state: 60 code: 102 message: [DataDirect][ODBC 20101 driver][Microsoft SQL Server]Incorrect syntax near

    Hi, I am currently receiving the following error in BI Answers when I run a query against a Microsoft SQL 2005 Server. View Display Error Odbc driver returned an error (SQLExecDirectW).   Error Details Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P State: H

  • No RMAN records in control file

    Hi, We're running 10.2.0.4 Database on AIX with no catalog Database. We keep all the backup info in controlfiles only. When we do that backup, we're able to successfully back it up (including archivelogs). But I'm unable to find any records in the co

  • Animated Text on Magazine Cover

    Hello, I am trying out DPS for one month and trying to create an animated cover for a magazine.  I have a couple of issues which would be great if I could get help with, I am a newbie. 1) I have imported an image into the publication as image sequenc