Showing posts with label last. Show all posts
Showing posts with label last. Show all posts

Sunday, February 7, 2016

Fetching Last 6 months data in SQL Server for Maximo

Below is one of the best ways to find number of tickets created in last 6 months in Maximo using SQL Server database.

Query is self explanatory

select month,countoftickets from (
SELECT DATENAME(MONTH,DATEADD(month, -5, GETDATE())) month,COUNT(*) AS countoftickets , 1 as fs FROM ticket WHERE MONTH(creationdate) = MONTH(DATEADD(month, -5, GETDATE())) union
SELECT DATENAME(MONTH,DATEADD(month, -4, GETDATE())) month,COUNT(*) AS countoftickets , 2 as fs FROM ticket WHERE MONTH(creationdate) = MONTH(DATEADD(month, -4, GETDATE())) union
SELECT DATENAME(MONTH,DATEADD(month, -3, GETDATE())) month,COUNT(*) AS countoftickets , 3 as fs  FROM ticket WHERE MONTH(creationdate) = MONTH(DATEADD(month, -3, GETDATE())) union
SELECT DATENAME(MONTH,DATEADD(month, -2, GETDATE())) month,COUNT(*) AS countoftickets , 4 as fs  FROM ticket WHERE MONTH(creationdate) = MONTH(DATEADD(month, -2, GETDATE())) union
SELECT DATENAME(MONTH,DATEADD(month, -1, GETDATE())) month,COUNT(*) AS countoftickets , 5 as fs  FROM ticket WHERE MONTH(creationdate) = MONTH(DATEADD(month, -1, GETDATE())) union
SELECT DATENAME(MONTH,DATEADD(month, 0, GETDATE())) month,COUNT(*) AS countoftickets , 6 as fs  FROM ticket WHERE MONTH(creationdate) = MONTH(DATEADD(month, 0, GETDATE()))  ) a1
order by fs

output:

Month   Countoftickets
October 10
November 12
December   5
January   17
February 20
March 15











---------------------------------------------------------------------------- All the messagesbelow are just forwarded messages if some one feels hurt about it please add your comments we will remove the post.Host/author is not responsible for these posts.

Friday, May 29, 2009

Gift--Lastforever

One man got a child > > > ..... ....
.... ..... ....
....
1 year later - man asked the child-what to gift you?
...
... ... ...
child said
ping pong ball
....
...
... ... 2'nd b'day- Father- what gift you want?
Son - ping pong ball ....
... .....
....
3rd b'day
Father- what gift you want? Son - ping pong ball
...
....
...
.... 4th bday Father- what gift you want?
Son - ping pong ball
....
...
.... ...
...
...
5th bday Father- what gift you want? Son - ping pong ball ....
....
... ... ...
...
....
....
6thb'day Father- what gift you want?
Son - ping pong ball
.....
... ....
... ... ...
....
....
>.......................................................................... .. .........
..................................
24th bday
Father- what gift you want?
Son - ping pong ball
...
.... ... ...
....
....
he got married
at honeymoon
Wife-what do u want?
Husband-ping pong ball
....
...
... .... 25th bday
Wife - what gift you want?
Husband-ping pong ball
....
...
.... ...
...
...
.... ...
26th bday
Wife - what gift you want?
Husband-ping pong ball
....
....
.... ... ...
27th bday
Wife - what gift you want?
Husband-ping pong ball ....
....
.... ...
...
....
>.......................................................................... ..
........
........................................................................
his kids become 15 yrs old
...
...
..... ...
40th bday
kids- Father what gift you want?
Father - ping pong ball
..... ...
....
.... ....
41st b'day kids- Father what gift you want?
Father - ping pong ball
.....
...
....
....
... ... 42nd bday
kids- Father what gift you want?
Father - ping pong ball .... ....
.....
....
.....
>.......................................................................... ..
......... >.......................................................................... ..
........
79th b'day
kids- Father what gift you want?
Father - ping pong ball
...
....
....
...

Before his death
all the people from whom he took ping pong ball
(Like his Wife, kids and all others) came to him and asked
Why did you ask for a ping pong ball all the time? ....
....
.....
He said give me a ping pong ball then I will tell you....
....
....
... Then those people gave him a ping pong ball
....
..... .....
.... ....
.... ...
..... ...
...
....
....
...
...
... ...
...
...
....
... ...
... ...
...
....
....
...
...
During those last moments when he is about to die
everyone reached him and asked
tell us why did you ask for ping pong ball always?
he said.
.....
.... .....
.....
.....
....
.....
....
.... ....
....
....
....
....
....
..... ....
....
.....
....
....
....
.... ....
....
....
....
....
....
.... ....
....
....
.....
....
....
.... I asked for a ping pong ball on my every b'day because
...
.... ...
...
...
....
...
...
... ...
...
...
.....
...
....
... ...
....
...
....
...
...
... ...
...
And he Died... before he could tell the Reason...
What a tragedy! What a tragedy!!!