How to get count of last 30 days and total of count of rows in a single query

Hi All,
My requirement is to write a sql query with the following requirement
I have a table TEST which has 6500 rows out of which the created date > 30 which means records from last 30 days are like 60.So if i write a query like this 
Select Count(*) from TEST where CreatedDdate > 30
This one would give me last 30 days count but in the same query i also want the count(*) which would be 6500
So my output should be one row with 6500 in one column and 65 in second column
Can someone please help me on how to do this?
If you have any questions or if i am unclear please let me know.
Thanks

declare @sdate table(sdate date)
insert into @sdate
values('20150418'),('20140418')
Select Count(*) as [total],count(case when(datediff(day,sdate,getdate()))<30 then 1 else null end) as [Last30days] from @sdate
Hope it Helps!!

Similar Messages

  • How to get line item net price and net value?

    I have using "BAPI_SALESORDER_SIMULATE" to SIMULATE to create SO,
    the return table
    ORDER_ITEMS_OUT-NET_VALUE is not equals than created by VA01 .
    how to get line item net price and net value?

    Hi,
    Can u elaborate ur query ?
    By this FM you cannot create a SO . Use FM --> BAPI_SALESORDER_CREATEFROMDAT2
    Regards,
    MAdhukar Shetty

  • I changed my LCD last day and now i noticed all my pictures on my phone are gone. I tried to restore the back that I got yesterday but it wont let me because its telling me there is not enough space on my phone!!!

    I changed my LCD last day and now i noticed all my pictures on my phone are gone. I tried to restore the back that I got yesterday but it wont let me because its telling me there is not enough space on my phone!!! That's wierd because I didn't download any app or anything else since my last backup and on the other hand about 3000 pictures are gone, how come there is not enough space left! I also check my usage on my phone and it shows that i have about 7.0 GB pictures!!! BUT my photos is empty! I want my picture back on my phone any solution anyone?

    Thanks for your reply!
    I just called the guy who changed my LCD and asked him what happend, he said there were no pictures on your phone when you gave it to me! i know he is lying tho!
    My apple warranty is over and I have to pay them to get some help over the phone!

  • How can I find the last day of the current month

    Is it possible to get the last day of the month in reports. Suppose I enter JUL in one of the text field. Now in reports I want to show that JUL contains 31 days. How can I retrieve the last day of the month.
    Any ideas?

    The first (and fast) solution I think is this:
    There is a function MONTH(CURRENT_DATE) that returns the number of the month of the current date.
    Now, you could use CASE WHEN expressions to determine the number of days returned since you now how many days does every month have.
    For instance, you could do:
    CASE
    WHEN MONTH(CURRENT_DATE)=1 THEN 31
    WHEN MONTH(CURRENT_DATE)=2 THEN 28
    WHEN MONTH(CURRENT_DATE)=3 THEN 31
    WHEN MONTH(CURRENT_DATE)=4 THEN 30
    END
    PD. This is faster that use OR expressions like 1 or 3 or 5 because you dont have to try every option.
    Hope it helps...but maybe there is another way more automatic.
    Edited by: linkln on 03/09/2010 08:21 AM

  • How to get Lion off my computer and go back to Snow Leopard???

    How do I get rid of Lion and go back to Snow Leopard PERMANENTLY?
    I am not techno.
    I need simple instructions with plain descriptions. I do not have any discs. The iMac came with Snow Leopard and I loaded NOTHING.
    I should never have bought  Lion. It is awful.
    Please someone tell me how to get Lion off my computer and go back to Snow Leopard.

    Can I use time machine to restart the machine before the fateful day when I bought and installed Lion?
    Yes, if you have a pre-Lion backup, but you need an installation disc.
    Is there anything else I can do?  more RAM?
    I don't know how much RAM you have. It must be at least 2 GB, or Lion wouldn't have installed. If that's all you have, you might get better performance by adding more. But from your description, I doubt that your problem is due entirely, if at all, to a lack of RAM. If you want to troubleshoot the problem, it will take some patience and effort, and you'll need to be in a calm frame of mind.

  • I have a problem with mail.  the spelling and grammer check box before sending the messege is no longer there.  I did everything but cannot get it back.  is ther anyone who knows how to get the box with spelling and grammer checks before sending

    i have a problem with mail.  the spelling and grammer check box before sending the messege is no longer there.  I did everything but cannot get it back.  is ther anyone who knows how to get the box with spelling and grammer checks before sending the mail.
    Also the mail is acting very funny by not getting the rules work in a proper method.  Is ther a software to repair mail.

    i did both of them, but still the while sending the mail the diolog box is not showing up and also the spelling and grammer does not do the spelling check. 
    This problem just started for about 3 to 4 days now.  earlier it was working normally.

  • Hey, i was using the trial version. today is my last day and i want to buy the reald paid version. will i lose the work i was doing till today if i buy the paid version?

    hey, i was using the trial version. today is my last day and i want to buy the reald paid version. will i lose the work i was doing till today if i buy the paid version?

    Your mileage may differ, but when you reach the end of the trial period, you will get a dialog telling you so and directing you to log into CC and activate that version.  You don't need to reload the program usually. 
    That said, if you were being careful, you would copy the program files to another directory.  Since the program manager assets are just pointesr to the files in the directories were they reside, you shouldn't need to copy the video/image files--just the program files

  • Hi, just need to know how to get my music, video, pictures and apps form my iPhone to my new laptop as the old computer, which I used before was stolen. I only have my phone left and if I try to conect it to my new laptop it's trying to delete everything.

    Hi, just need to know how to get my music, video, pictures and apps form my iPhone to my new laptop as the old computer, which I used before was stolen. I only have my phone left and if I try to conect it to my new laptop it's trying to delete everything.

    I have also noticed all my settings won't stay set, example....I removed the check mark from "third party cookies", the when I close Firefox and reopen the check mark is back, also my tool bar has screwed up....can't reset, been having trouble the up grade.

  • I just downloaded the new iOS 5.0 and did all of the backup prompted steps beforehand, but I can't figure out how to get all of my apps and music back on my iPhone. Where did they go and how can I put them back on my iPhone?

    I just downloaded the new iOS 5.0 and did all of the backup prompted steps beforehand, but I can't figure out how to get all of my apps and music back on my iPhone. Where did they go and how can I put them back on my iPhone?

    Hi, Abril_Perez17.
    This may be related to a new feature embedded in iOS7 that shows all purchased music by default.  Go to Settings > Music, then turn off Show All Music.  See if the issue ceases once the feature has been disabled.  This information is located on page 63 of the user guide below. 
    iPhone User Guide
    Regards,
    Jason H. 

  • How to get the all process orders and outbound deliveries based on material

    Hi Team ,
    I need one help from you regarding the MB 56 transaction.
    My doubt is : How to get the all process orders and outbound deliveries based on material, plant and batch?
    Please help me regarding this.
    Thanks & Regards,
    Srikanth.

    Hi,
    You can use ST05,to trace the program and find out,
    hope it will help you...
    thanks and regards,
    veera.

  • How to get  shipped orders, unshipped orders and orders with open deliverie

    Hi
    how to get  shipped orders, unshipped orders and orders with open deliveries
    can anybody answer this.
    points would be rewrded
    Thanks

    Hi,
    You can check in the VBUK table for the status of an order. If you do a Query on VBUK table to get all the orders whose delivery status is not 'C' or the total goods movement status is not 'C' you get to know the orders not yet shipped.
    Hope this helps. Reqard points if useful.
    David.

  • When i update my IOS7 i lost my all pic from my IPAD2 how to get back those pic? and i don,t think so i did kept back up before i did that. can anyone help me for this issue?

    When i update my IOS7 i lost my all pic from my IPAD2 can anyone suggest how to get back those pic? and i don,t think so i did kept back up before i update ios7. can anyone help me for this issue?

    The photo's in your camera roll would be in a backup, if you have one (iCloud or iTunes).  If you did not keep a backup somewhere, they are gone.  Sorry, but that is the way of any data - if you don't have a backup of it somewhere, there is nothing to restore it from.
    All other photo's should be on your computer somewhere anyway - whereever you had them to sync to the device originally.

  • How to get the health , performance information and about the services run on devices that have connected to the system center?

    Hi All,
    I want to know how to get the health , performance information and about the services run on devices that have connected to the system center to my c# application. Also I need to know about the information of databases that have connected to system center.
    I will appreciate your feedback
    Thank you

    Hi,
    You can configure service monitor for the required service on the server
    refer below link for how to configure service monitoring
    http://www.bictt.com/blogs/bictt.php/2011/03/17/scom-monitoring-a-service-part3
    You can use SCOM SDK to connect to the scom server using c# and get required information
    http://msdn.microsoft.com/en-us/library/hh329086.aspx
    you can find the database in below registry path on management server
    HKLM:\SOFTWARE\Microsoft\Microsoft Operations Manager\3.0\Setup\DatabaseName
    Regards
    sridhar v

  • How to get cloud services CPU Percentage and Network In

    Hi,
    I am using Service management API to collect the cloud services related metrics for example
    Cloud name, Status and location etc.
    How to get the CPU, memory, network and disk related metrics of cloud services using the same API.  I am using java code to collect all the details. Please verify the below source code..But i did not get the output. But there is no error message. Help
    me how to get those details..
    Configuration config = ManagementConfiguration.configure(
    new URI(uri),
    subscriptionId,
    keyStoreLocation, // path to the JKS file
    keyStorePassword, // password for the JKS file
    KeyStoreType.jks  // flag that you are using a JKS keystore
    CloudServiceManagementClient cldCli = CloudServiceManagementService.create(config);
    CloudServiceOperations cldOpe = cldCli.getCloudServicesOperations();
    CloudServiceListResponse cldListRes = cldOpe.list();
    ArrayList<CloudServiceListResponse.CloudService> cldServices = cldListRes.getCloudServices();
    if(cldServices != null)
    for(int cc=0; cc<cldServices.size();cc++)
    CloudServiceListResponse.CloudService yesCld = (CloudServiceListResponse.CloudService)cldServices.get(cc);
    if(yesCld == null)
    continue;
    ArrayList<CloudServiceListResponse.CloudService.AddOnResource> cldResRes = yesCld.getResources();
    if(cldResRes == null)
    continue;
    for(int r=0; r<cldResRes.size(); r++)
    CloudServiceListResponse.CloudService.AddOnResource addOnRes = cldResRes.get(r);
    if(addOnRes == null)
    continue;
    ArrayList<CloudServiceListResponse.CloudService.AddOnResource.UsageLimit> cldUse = addOnRes.getUsageLimits();
    if(cldUse == null )
    continue;
    for(int u=0;u<cldUse.size(); u++)
    CloudServiceListResponse.CloudService.AddOnResource.UsageLimit useLimit = cldUse.get(u);
    if(useLimit == null)
    continue;
    System.out.println("NAME:"+useLimit.getName()+"UNIT "+useLimit.getUnit()+" Amount used "+useLimit.getAmountUsed());
    Thanks & Regards,
    Rathidevi

    Hi,
    The Azure Diagnostics capability supports the configuration of diagnostics information than can be captured locally on a role instance and then persisted to Azure Storage on some timescale, this only support Azure Cloud service, I think it is useful for
    us to analyze the performance, if you don't want to use it, please try to use
    Azure Monitoring Service API, for more information, refer the below articles.
    #https://convective.wordpress.com/2014/06/22/using-azure-monitoring-service-with-azure-virtual-machines/
    #https://convective.wordpress.com/2014/06/27/using-azure-monitoring-services-api-with-azure-cloud-services/
    Best Regards,
    Jambor
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to get the NT user id and passwd

    Hi,
    How to get the NT user id and passwd using form 6i

    You cannot get the password. Password are stored in an encrypted format. Almost never decrypted (as a security meassure). Authentication is performed by encrypting the supplied password and matching that against the stored encrypted password.
    Think about it.. just how dangerous it will be to have a function that can dump NT users and their passwords for you. How can you ever expect to "simply decrypt a password"?
    As for getting the user name. See the Win32 kernel API call GetCurrentUser(). Also note that there is a big difference as to the owner/user of a server process/thread versus the end-user of client application (possibly running on another PC) that is making the call to the server.
    Of course, none of this is related to SQL or PL/SQL - which is what I believe the subject matter of this forum is... Kindly suggest that in future you pay attention to posting the correct subject material to the correct forum.

Maybe you are looking for

  • REP-52005: The specified key rep_drill does not exist in the key map file.

    Hi I am using Forms and reports version 11.1.1.4.0 Weblogic 10.3 I wanted to create a drilldown report I have modified the cgicmd.dat file in the below location C:\ORACLE\Middleware\user_projects\domains\CL2DOMAIN\config\fmwconfig\servers\WLS_REPORTS

  • You do not have the necessary access privileges

    I reinstalled the sytem and now can't save a photoshop file or pdf. What's up?

  • Finding missing components between two tables

    If I had a table named package_part which has several columns: Site Parent Sequence Child Qty_per_assembly Contents eg: WH1, 123, 1, A, 1 WH1, 123, 2, B, 2 WH1, 123, 3, C, 1 WH2, 123, 1, A, 1 WH2, 123, 2, C, 1 WH2, 123, 3, E, 3 I want to report packa

  • Problem with the Creatve Cloud download on my computer

    When i try to install the app Creative Cloud on my computer, the installation stops ans it's write "installation failure. error code : 62" Please, could you tell me what is this error code and how resolve it ? Thank you!!

  • Instalacion en Linux NI LabVIEW 2013

    Buen Día. Estoy intentando, Instalar el LabVIEW 2013 desde un CDROM original proporcionado por mi institución educativa, tengo sistema LUBUNTU 14.04 pero no logro ni montar el CD mediante "apt-cdrom add" me gustaria recibir información sobre la maner