Forum Replies Created

Viewing 15 posts - 361 through 375 (of 424 total)

  • RE: Top N plus

    The CTE suggestion is really no different than our existing temp table technique. The problem is it still has to calculate the ranked metric for the entire dataset and...

  • RE: SQL query

    select T.*

    from yourTable T

    join yourTable T2 on T.user_id = T2.user_id

    and dateadd( hour, 1, T.punch_out ) = T2.punch_in

  • RE: trouble with joining tables

    also consider eliminating the month(), date(), year() comparisons

    SELECT COUNT(tblConferences.Division) AS Total,

    tblConferences.Subdivision, tblConfAtt.ConfDate,tblConfAtt.CustomerID

    FROM tblConfAtt

    INNER JOIN tblConferences

    ON tblConfAtt.Conference = tblConferences.Room...

  • RE: Data Modelers - Alternatives to Erwin

    also take a look at sybase powerdesigner.

  • RE: trouble with joining tables

    try rounding both datetimes.

    select '11:29',

    dateadd(minute,

    round(cast(datediff(minute, 0, '11:29') as float) / 60,0) * 60, 0)

  • RE: SubQuery returning more one record

    Select ...

    ,(SELECT DISTINCT b1.FirstName + ' ' + b1.LastName FROM dbo.consultant

    LEFT OUTER JOIN dbo.uvwConsultantDownLine AS B1 ON D.SponsorID = B1.ConsultantID) AS SponsorName

    ,D.SponsorID

    ...

    from #Downline D with (nolock)

    LEFT OUTER JOIN uvw_DownlineOrder O...

  • RE: SubQuery returning more one record

    , (SELECT DISTINCT b1.FirstName + ' ' + b1.LastName

    FROM dbo.consultant

    LEFT OUTER JOIN dbo.uvwConsultantDownLine AS B1

    ON D.SponsorID = B1.ConsultantID) AS SponsorName

    the left outer...

  • RE: Query/SubQuery unexpected behavior

    Yeah, agreed, except that I don't want it to 'try to figure out'. Thanks, guys, for the verification it's not a bug. I still don't like it though. I'm just...

  • RE: Query/SubQuery unexpected behavior

    Hey, SSCrazy. That sounds good except that now I have to question the design. You're right that the alias makes it fail correctly ( isn't that ironic? You have...

  • RE: New to 2005, Looking for advice on the best way to write a query

    thanks again todd. i'm somewhat skeptical about what naysayers that never use a feature say about a feature.

    them: "it's awful, i never use it for...

  • RE: New to 2005, Looking for advice on the best way to write a query

    hey todd. thanks for the feedback. when i give a suggestion i don't always put on my qa hat as i just want to help someone down the road...

  • RE: COMPARE GETDATE() WITH RUN_DATE COLUMN IN sysjobhistory TABLE

    just convert getdate() to an int and leave run_date alone:

    cast(convert(char(8),getdate(),112) as int)

  • RE: Need Help with my sql code

    sorry the comparison should be TimeStamp >= date expression

    run these statements:

    select dateadd(month, -12,

    dateadd(day,1 - day(getdate()),

    ...

  • RE: Need Help with my sql code

    WHERE TimeDateStamp

    BETWEEN DATEADD(mm, DATEDIFF(mm,0,getdate()), 0)

    AND

    DATEADD(ms,-3,DATEADD(mm,DATEDIFF(m,0,getdate()) +1, 0))

    try this instead:

    where TimeDateStamp <=

    dateadd(month, -12,

    dateadd(day,1 - day(getdate()),

    convert(char(10),getdate(),120)

    ...

  • RE: New to 2005, Looking for advice on the best way to write a query

    i've read that the drawback of row_number() is that it must be calculated for the entire partition of the over() clause and thus usually results in higher io. anyone...

Viewing 15 posts - 361 through 375 (of 424 total)