Forum Replies Created

Viewing 15 posts - 421 through 435 (of 860 total)

  • RE: Get Geometric Mean for all the records

    AllaboutSQL (4/25/2012)


    This is what you are trying to do -

    DECLARE @fac INT ;

    set @fac = 1;

    With tally (n) AS (SELECT top 100 ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) FROM...

  • RE: Get Geometric Mean for all the records

    HowardW (4/25/2012)


    This looks like a running total problem to me (with multiplications as opposed to additions). Most set-like solutions are going to run into some pretty horrendous triangular joins quite...

  • RE: Get Geometric Mean for all the records

    yep those are recursive cte's. im currently trying to solve the factorial with a numbers table and i think im close. should have it soon

    EDIT: can only...

  • RE: Get Geometric Mean for all the records

    or do you want a product function where if you have the values 1,3,5,7 the result would be 1*3*5*7 and you just happened to use 1234 so it looks like...

  • RE: get local variable value

    Mark Fitzgerald-331224 (4/25/2012)


    riya_dave (4/24/2012)


    my select statement

    insert into #temp7

    select a.shortname , a.portfoliobaseid , a.account ,a.InceptionDate,

    a.DTDTWR,

    MTDTWR = case when (a.MTDTWR is null) then

    (exp(sum(LOG(CASE WHEN b.monthirr = 0.0 THEN 1 WHEN b.monthirr...

  • RE: Get Geometric Mean for all the records

    AllaboutSQL (4/25/2012)


    Hi, is there any specific reason why you wouldnt want to use loop for this?

    that seems to be the simplest solution, also, I am assuming that the number of...

  • RE: Get Geometric Mean for all the records

    phani.gudmines (4/25/2012)


    .....

    1(1)

    2(1*2)

    6(1*2*3)

    24(1*2*3*4)

    what you have as your requested out is the factorial of the number. do you really want the geometric mean of the 4 entries (take the 4th root...

  • RE: Today's Random Word!

    EL Jerry (4/24/2012)


    SQLRNNR (4/24/2012)


    crookj (4/24/2012)


    L' Eomot Inversé (4/24/2012)


    SQLRNNR (4/24/2012)


    replicating

    reproducing

    Cloning

    Dolly

    Parton? 🙂

    "El" Jerry.

    Triple X :hehe::hehe:

  • RE: Stumped on a SQL Query

    Dave Brooking (4/24/2012)


    As Capn Hector said a self join will work. I think he has the join condition slightly wrong and mixed up the empid and supid

    WITH emp AS

    (

    SELECT 1000...

  • RE: Snowflake Database design - Advice needed.

    flebber.crue (4/24/2012)


    capn.hector (4/24/2012)


    as vinu said about the "master" tables. many players can play on a team and a player can play on many teams (not at the same time...

  • RE: Stumped on a SQL Query

    nope a self join will work. with out create table statements and sample data its hard to give tested code but something like this may work

    SELECT a.EmpID, a.BossID, a.EmpName,...

  • RE: Occurrence count

    drew.allen (4/24/2012)


    I agree with Lynn here. If you can't represent your problem with 50 or fewer records, then your problem is probably too complex to solve in a forum...

  • RE: sp to create date table

    gissah (4/24/2012)


    maybe that is the best way to go, yearly. can you please guide me through it.

    here is part of my calendar table script. the tally in the from...

  • RE: sp to create date table

    looks like you are creating your calendar table every morning?? is that correct?? i have a calendar table which just sits there and i have it out to 2016-01-01...

  • RE: Filtering rows from one table.

    The_Mo (4/24/2012)


    exactly:-D

    ok so my solution was wrong any way. here is the correct version of my solution

    SELECT * FROM

    (SELECT ROW_NUMBER () OVER (PARTITION BY DateValue,Value ORDER BY (SELECT NULL))...

Viewing 15 posts - 421 through 435 (of 860 total)