|
Thanks for your reply,
Will check the differences
|
|
|
|
|
Hi Blue_Boy
Thank you so much dude.
|
|
|
|
|
Another option is the USE of Decode function that will also give u the correct result with out using the temp table or variable, if u can share the data of yr mytable then will try to give u the sql query.
|
|
|
|
|
I want to select closed requests per month and total request per month both
my table is like
RequestID,RequesterName,RequestStatus(OPen/close),RequestedDate.
From these fields i have to fetch that data,
|
|
|
|
|
Hope this will work
select years, month, sum(MonthCount) from
(
SELECT to_char(trunc(RequestedDate, 'Year'), 'YYYY') as Years, to_char(trunc(RequestedDate, 'Month'), 'MON') as Month, count(to_char(trunc(RequestedDate, 'Month'), 'MON')) as MonthCount
FROM MYTABLE
group by to_char(trunc(RequestedDate, 'Year'), 'YYYY'), to_char(trunc(RequestedDate, 'Month'), 'MON')
union
select '2012' as years, 'JAN' as Month, 0 as MonthCount from dual
union
select '2012' as years, 'FEB' as Month, 0 as MonthCount from dual
union
select '2012' as years, 'MAR' as Month, 0 as MonthCount from dual
union
select '2012' as years, 'APR' as Month, 0 as MonthCount from dual
union
select '2012' as years, 'MAY' as Month, 0 as MonthCount from dual
union
select '2012' as years, 'JUN' as Month, 0 as MonthCount from dual
union
select '2012' as years, 'JULY' as Month, 0 as MonthCount from dual
union
select '2012' as years, 'AUG' as Month, 0 as MonthCount from dual
union
select '2012' as years, 'SEPT' as Month, 0 as MonthCount from dual
union
select '2012' as years, 'OCT' as Month, 0 as MonthCount from dual
union
select '2012' as years, 'NOV' as Month, 0 as MonthCount from dual
union
select '2012' as years, 'DEC' as Month, 0 as MonthCount from dual
) group by years, month
|
|
|
|
|
Thanks deepak,
But i getting 2 errors after executing , i changed mytable to my real table, but it giving below mentioned errors
1) 'trunc' is not a recognized built-in function name
and
2)Incorrect syntax near ')'.
|
|
|
|
|
Hey i just used the trunc method for oracle, u can replace to yr old year and month method to get the result, but the concept is that we will use the union clause to get the data for those month for which we dont have the data than we will do a union with yr old query then on the top of that put a sum for monthcount with group by month and year.
so yr query will be
select years, month, sum(MonthCount) from
(
SELECT YEAR(RequestedDate) as Years, Month(RequestedDate) as MonthInNumbers,Count(Month(RequestedDate))
FROM MYTABLE
group by YEAR(RequestedDate),Month(RequestedDate)
union
select '2012' as years, 'JAN' as Month, 0 as MonthCount from dual
union
select '2012' as years, 'FEB' as Month, 0 as MonthCount from dual
union
select '2012' as years, 'MAR' as Month, 0 as MonthCount from dual
union
select '2012' as years, 'APR' as Month, 0 as MonthCount from dual
union
select '2012' as years, 'MAY' as Month, 0 as MonthCount from dual
union
select '2012' as years, 'JUN' as Month, 0 as MonthCount from dual
union
select '2012' as years, 'JULY' as Month, 0 as MonthCount from dual
union
select '2012' as years, 'AUG' as Month, 0 as MonthCount from dual
union
select '2012' as years, 'SEPT' as Month, 0 as MonthCount from dual
union
select '2012' as years, 'OCT' as Month, 0 as MonthCount from dual
union
select '2012' as years, 'NOV' as Month, 0 as MonthCount from dual
union
select '2012' as years, 'DEC' as Month, 0 as MonthCount from dual
) group by years, month
|
|
|
|
|
Hi,
I've developed a report in SSRS 2005. My query is returning more that 65,000 rows and I'm getting an error when exporting the report to excel. Any idea how to solve this?
The report can be exported successfully in PDF
Cheers
Berba
|
|
|
|
|
This is a limit of Excel. I beleive Excel 2010 allows for more than 65,000.
I think you only solution would be to break the results into multiple Excel documents.
Remember to vote.
|
|
|
|
|
Microsoft does not know that Excel can now hold more rows, even when you tell it to use the newer format.
|
|
|
|
|
65k rows is NOT a report, it is a data dump. You are using the wrong tool for the job, you should be exporting the data as csv either from the database or your client application NOT a reporting tool!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
The report is loading fine on the asp.net webpage via the report viewer control.
It's just when exporting to excel the customer is getting an error. In PDF it is fine
|
|
|
|
|
berba wrote: It's just when exporting to excel the customer is getting an error
Which means it is the WRONG tool for the job. The tool has a limitation, as pointed out by David and djj.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I am trying to do this in Microsoft Access. I seem to be unable to construct a 'simple' query. To illustrate, here is a sample table:
Field1 Field2 Amount
A New 10
D Old 5
G Old 1
H Old 15
H New 55
X Old 20
Z Old 100
Z New 20
I need to group by Field1 and only return the Field2 data for the record that has the maximum number in the Amount field. I tried to use the 'First' function but Microsoft Access sort the records internally so it does not return the right value even if I pre-sort the records with a sub-query. Do you have any advice? The result should look like the table below.
Desired Result:
Field1 Field2 Max(Amount)
A New 10
D Old 5
G Old 1
H New 55
X Old 20
Z Old 100
I have trouble getting the value of Field2 in the record containing to the maximum value of 'Amount.'
Any suggestions? Thanks in advance for your time!
modified 6-Dec-12 11:51am.
|
|
|
|
|
You can try this query
SELECT mt.Field1,
(
SELECT TOP 1 mt2.Field2
FROM myTable mt2
WHERE mt2.Field1 = mt.Field1
ORDER BY
mt2.Amount DESC
) AS Field2,
MAX(mt.Amount)
FROM myTable mt
GROUP BY
mt.Field1
I Love T-SQL
"VB.NET is developed with C#.NET"
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
|
I just got a new 64bit machine and I'm migrating my code from my old 32bit machine. I wanted to install Oracle Data Providor for .NET, the 64bit one and I selected 64-bit ODAC 11.2 Release 5 (11.2.0.3.20) Xcopy for Windows x64 bit it had a note:
"Important: The 32-bit Oracle Developer Tools for Visual Studio download is required for Entity Framework design-time features".
So I installed the 32 bit Oracle Data Provider for .NET which is ODAC 11.2 Release 5 and Oracle Developer Tools for Visual Studio (11.2.0.3.20) with the hope that I could do the 64 bit installation on top of that.
Now the 64bit installation does not go through and I am not able to uninstall the 32 bit installation and I have no clue how to get out of this mess.
Sorry this is my first time installing as well as posting, experts please guide me.
|
|
|
|
|
"Virtual Machine"
Don't use your primary development-machine as a testing-ground; use a virtual machine. I know it's slower, but it's also a lot safer.
|
|
|
|
|
Sounds like your advice comes a bit late...
Cheers,
Peter
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
I imagine he is trying to set up his primary development machine, not just testing a new environment.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Investigate wether you have a system restore point prior to the installation of the driver!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi everyone,
I'm having trouble with this query in SQL (homework!).
I have two tables: customer and staff.
== Customer (the relevant fields) ==
customer_id
first_name
last_name
== Staff ==
staff_id
first_name
last_name
The question is: "select the first and last names of all customers and staff".
Can anybody help on how to do that? I don't know how to "append" the results of the two queries, and googling I can only find about INSERT ... SELECT, which is not what I'm looking for =\
Best regards to all.
Fratelli
|
|
|
|
|
Perhaps the keyword "UNION" may help you.
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]
|
|
|
|
|
It does indeed !
Thank you
Fratelli
|
|
|
|
|
Hi Guys,
I have a problem to create data base.
My requirement is like
there are 4 different sites are there and every site has a common checklist to be checked and sites also have extra check list to checked with common check list, for this how i should create data base table.?
Thanks in advance
Vishwa
|
|
|
|
|