Forum Replies Created

Viewing 15 posts - 91 through 105 (of 166 total)

  • RE: last 6 months data

    Hi Luis,

    That's awesome and thanks for your time on this. It works perfect. having one final question,

    on the below sample

    DECLARE @val int = 3;

    WITH Months AS(

    SELECT...

  • RE: last 6 months data

    Hi Luis, Thanks for coming back,

    Here is the scenario,

    for example :

    declare @val int

    if @val = 2 then below should be constructed

    WITH Months AS(

    SELECT UPPER(convert(varchar(3),datename(month,...

  • RE: last 6 months data

    Hi Luis,

    got into tricky situation on this logic, Is it possible to make the below line as dynamic

    FROM (VALUES (6),(5),(4),(3),(2),(1)) x(N)

    for example i have one more column called "RecordCreationDate" and...

  • RE: using count with select case

    Hi Jeff,

    Yes, it really easy and straight forward solution. Good learning for me today. Thank you so munch for mentoring me.

  • RE: using count with select case

    This is how i achieved now.

    with Marks as(

    select 20 as score

    union all

    select 30 as score

    union all

    select 70...

  • RE: last 6 months data

    Yes I learnt CTE today. Thank you so much

  • RE: last 6 months data

    Great and here is the final version of working query. even i did rounded the amount to nearest values.

    WITH Months AS(

    SELECT LEFT( DATENAME(MONTH, DATEADD(MM, DATEDIFF( MM, 0, GETDATE()) -...

  • RE: last 6 months data

    to remove the current month data i tweaked the logix and it works fine

    SELECT right(CONVERT(CHAR(11),DATEADD(MM, DATEDIFF( MM, 0, GETDATE()) - N, 0), 6),8) month_name,

    DATEADD(MM, DATEDIFF( MM, 0, GETDATE()) -...

  • RE: last 6 months data

    Thank you Genius. Really it helped me a lot. trying to understand the query and having tiny doubt that how the year is getting displayed along with the month name....

  • RE: last 6 months data

    Opps My bad, i din't watch the Luis reply.

    Hi Luis, Apologize for my mistake. below is the query which i tweaked from yours.

    select convert(varchar(3),datename(month, Visiteddate)) as validdate , --Will...

  • RE: last 6 months data

    Hi Luis,

    Could you please tell me what do you mean by "I just love being ignored". Does it mean that ignoring this thread.........

  • RE: last 6 months data

    hi Torpkev,

    thanks for your reply. actually the avg gives in terms of decimal. i just rounded and shown as result.

    But on your query where is the condition to get...

  • RE: case in where clause

    Thank you Gentle Man!!:-)

  • RE: case in where clause

    Hi Scott,

    You solution works fine now and thanks a lot.

    Hi Luis,

    Thanks for your reply too and as i said just thought of doing it in single query other then using...

  • RE: case in where clause

    Yes, I tried your query and it gives wrong result.

    pass the idEmployee as 2

    It should give the result as 'Address2' only only time. But your query produces the two times.

    The...

Viewing 15 posts - 91 through 105 (of 166 total)