SQL Server :: Pivotal Query To Sum Up Months And Quarters Together?

Sep 22, 2010

i need below output do i need to use cursors for this can i do this with case statement.

CREATE TABLE [dbo].[tablesales2](
[ID] [int] IDENTITY(1,1) NOT NULL,
[Name] [nchar](10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[cost] [numeric](18, 0) NULL,
[saledate] [datetime] NULL,
)

[code]....

View 9 Replies


Similar Messages:

SQL Server :: Insert 0 Value For Months When No Data Exists?

Dec 1, 2010

Banging my head with this one...

I have a SQL query that pulls data for charting based on a per month basis. The month range is dynamic and selected from the front end. My issue is when no data for a month within the month range is present, that month is skipped. Is there a way/method to have the query give a 0 value for the columns when no data for that month exists? Below is my current query

[Code]....

View 8 Replies

SQL Server :: How To Get Month And Year In Single Column And Grouping The Data For All The Years And Months

Jan 10, 2011

For the below query (sdate is column name and table name is storedata)

View 2 Replies

DataSource Controls :: Can't Find Query's / By Right Clicking On Database Created A Query In Server Explorer?

May 17, 2010

By right clicking on my database i created a query in server explorer. But where are this query stored can't find them back. I should aspect that their is a folder query's like there is a folder tables but this isn't the case.

View 10 Replies

SQL Server :: Sub Query In Cross Table Query To Create Statistics

Mar 2, 2011

I am trying to create statitics for game downloads and am having dificulty with a sub part of my query. the goup by command is not having the disired result and i think i have been looking at it too long to see what i am doing wrong. [Code]....

At the moment it is producing each result in many rows when only 4 rows should appear. its the download column that is doing it. needs to be sub queried or something to display total in relation to month,gameid,userid.

Month-download-GameID-UserID

1 1
1 1

1 1
1 1

View 2 Replies

SQL Server :: Query Slow In Loading / Trying To Display Query Result?

Feb 1, 2011

I am trying to display this query result in an aspx page.

It is very slow in loading. Here is the query. The inner query inside the outer quesry is the problem.(Please see the underlined part in the query) - (If I remove that part it is very fast.)

select

top 500

--This column is the issue
,Governing_Class=( case when exists (select top 1 tqc.class_code from
t_quote_class tqc
inner join t_quote_class_premium tqcm on tqc.class_code =tqcm.
class_code
where tqc.appid=pi.appid and tqc.class_code not in('8742' ,'8810','7380')
order by tqcm.premium_amt desc
)
then ( select top 1 tqc.class_code from
t_quote_class tqc
inner join t_quote_class_premium tqcm on tqc.class_code =tqcm.
class_code
where tqc.appid=pi.
appid
order by tqcm.premium_amt desc
)
......... From tables

View 7 Replies

Databases :: Oracle Query Convert To Sql Server Query

Sep 3, 2010

I am a biggner in SQL DB . but i started a complicated and painfull work in SQL SERVER 2008. the problem convert Oracle hierarchical query to SQL query. the query

SELECT DISTINCT
LEVEL LVL,
SCH.NSCHEDULE_SL,
SCH.NSCHEDULE_SL_FM,
SCH.CSHED_CNAME
FROM FA_SCHEDULES SCH
WHERE LEVEL = 1
AND NSCHEDULE_SL_FM IS NULL
AND NBRANCH_SL = 2
CONNECT BY PRIOR SCH.NSCHEDULE_SL_FM = SCH.NSCHEDULE_SL
AND NBRANCH_SL = 2

View 1 Replies

SQL Server :: How To Copy Result Query To Another Query

Nov 4, 2010

i have tow query in one stored procedure

first query and the second one every of them return only value

i want to copy the result of tow values in a new row in new table

as i want to check on this tow values in ado.net

i want to get only this tow values as a row not first and secon query

only a row has result of first and second query results

[Code]....

View 3 Replies

SQL Server :: Select Second Query If First Query Returns Nothing?

Oct 14, 2010

How can I SELECT second if first SELECT returns nothing?

View 8 Replies

SQL Server :: Get All Rows From Query A That Are Not In Query B?

Dec 17, 2010

Using sql server 2005.

I have an Query A of fields that returns X number of records.

I create a Query B of same fields that returns X-80 number of records.

I want to find out the 80 records that are in Query A but are not in Query B. what is the syntax for this?

View 4 Replies

Web Forms :: How To Compare Months

Nov 9, 2010

I have two textboxs consists of date.

Textbox1 = 11/09/2010

Textbox2 = 12/11/2010

I would like to compare those 2 dates actually months. If months are different i would like to do something else.

View 2 Replies

SQL Server :: Trying To Get A Query Going In SQL Server But Get Bad/ Errors In The Query?

Nov 8, 2010

Trying to get a query going in SQL server but I get bad/ errors in the query.I have a 2 tables. One is the "Project" table while the other is the "Task" table.Table structure is as follows.

Project table => ProjectID,ProjectName
Task table => TaskID, TaskName,ProjectID,Quarter, Hours

A project can have many task. The ProjectID in Task table is the foreign key which reference the project ID.What I need to do is to SUM all the hours in the Task table and group it by quarter and then group it by ProjectID. Output of the SQL should be in the form of projectID,Quarter, Hours.

View 2 Replies

Calendar Control Show Only Months?

Jun 30, 2010

I have a AJAX calendar control it shows selection for specific date.

However I have an input control to key in just month. Can we modify the behavior of Calendar control to show only month/year selection but not the dates ?

View 2 Replies

Web Forms :: How To Calculate Age In Years And Months

Sep 14, 2010

I need to calculate the Age and give a reading in this format: X Years, X Months.

My ASPX page is parsing

<%#GetMachineAge(Eval("Age"))%>

What calculation do i need in my code behind?

View 2 Replies

.NET Calendar With Multiple Months Showns Together?

Mar 11, 2011

In my asp.net application there is a requirement where there is a textbox and right next to the textbox there is a calender image. When i click the calender image a calender should come up and i should be able to select a date in a month.Normally i could use AjaxcontrolToolkit calender control, but the problem here is that here i have to show two consecutive months together side by side. And there is an arrow at the left side of one month and an arrow at the right side of the other month so that i can navigate to other months.

View 1 Replies

Get The Number Of Months And Exceed Days?

Feb 3, 2011

here is my sample is this correct?

number of months=nms
days=30 days only

sample: nms=30 days count from the date hired

is this correct?

View 1 Replies

Validator To Compare Two Date Difference Is Not More Than 12 Months?

Feb 22, 2010

I have two TextBox controls for start date & end date input. I have to validate that end date is not greater than start date & the difference between start date & end date is not more than 12 months.

View 2 Replies

How To Create Calender Control With Multiple Months

Nov 3, 2010

i want to create calender control with multiple months.i search so many website. i got a solution using jquery. i didn't get clear solution.

View 5 Replies

Crystal Reports :: Displaying Months In A Year

Dec 13, 2010

I am trying to create a report which is composed of all of the months in a year. My biggest problem is that we do counts for each month. These counts shouldn't change for previous months. They should remain static. But when I run the current month, I want to display the values in the previous months plus my current value. Do I need to create a formula for each month of the year or is there an easier way to capture this information?

For example:

The end of the fiscal year is July 11. I want to check my values for February to see what accounts are open and counted for this month as well as the accounts that are still open from January. These would all display in February. But I want the January account to report the same number (all accounts open in January) it held when I ran it in January. I want to do this for the entire year.

View 1 Replies

Web Forms :: How To Create Web App That Shows All Months Of A Year

Mar 13, 2011

I need to create asp.net web application in which i have to show Calendar that displays all months of year with Navigation buttons like Next, Previous to move on next years months. Is there ficibility to modify asp.net calendar control to show all months of a year?

View 3 Replies

AJAX :: Display Two Months On One Button Click?

Nov 1, 2010

I am asked to popup the calendar with two months. When a user selects a date, it popups in a textbox. The botton I have now may trigger only one calendar, not two. I saw someone asked the same question, but it didn't get solved. I know that I may code myself with two asp:calendar controls and divs, and play show/hide, but that's more work.

View 3 Replies

Web Forms ::show Two Calender Months In Same JavaScript Pop Up?

Mar 11, 2010

I have requirement to show two calander months in same JavaScript pop up. when user click start date, then open popup window then it should display the current month and next month. then user has to chanse select either this month or next month date in the same window.

View 4 Replies

Web Forms :: How To Display Quarter Months In DropDown List

Jan 7, 2011

I have a dropdown list where i wanted to display months in reversed quarterly format based on the current month.

for eg. if this is the month of January 2011.. so the list has to display from the previous quarter onwards....

the dropdown list has to display:-

Oct 2010 - Dec 2010
Jul 2010 - Sep 2010
Apr 2010 - Jun 2010
Jan 2010 - Mar 2010

and so on...

View 8 Replies

DataSource Controls :: Stored Procedure - How To Get Date Within 12 Months

May 21, 2010

I am trying to add a condition where a section of my stored procedure will run if it is 12 months or less. Right now I have it set as

if @dtDate <= '5/21/2010' but I know that won't work because I want it to dynamically get today's date each day. Does any know how I would do this.

View 2 Replies

AJAX :: Calendar Control Showing Multiple Months

Dec 15, 2010

I am using Ajax calendar control, my client requesting me to show 2 months at a time when calendar control gets populated. Please tell me how to show multiple months using Calendar control

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved