Forum Replies Created

Viewing 15 posts - 1,966 through 1,980 (of 2,171 total)

  • RE: i want yesterdays''''record if today''''s

    You mean like this? No need to change existing selects, just add one more select before the others.

    CREATE PROCEDURE SP_news_date

    (

     @news_date datetime

    )

    AS

    SELECT @news_date...

  • RE: sequencing a column with group by

    Yes, but you changed the testdata in this topic too...

    This was the original test data in this topic.

    A  B  C

    1, 1, 1

    1, 1, 1

    1, 1, 1

    2, 2, 2

    2,...

  • RE: sequencing the column with group by v2

    Sergiy, try to run your code against this test data...

    declare @tableA table (a int, b VARCHAR(3), c VARCHAR(4))

    insert @tableA

    select 1, 'DD', '5' union all 

    select 1,...

  • RE: sequencing the column with group by v2

    Or this one for handling ties.

    -- Prepare test data

    --

    -- Demonstration only. Not needed in your environment.

    --

    declare @tableA table (a int, b VARCHAR(3), c VARCHAR(4))

    insert @tableA

    select 1,...

  • RE: sequencing the column with group by v2

    -- Prepare test data

    --

    -- Demonstration only. Not needed in your environment.

    --

    declare @tableA table (a int, b VARCHAR(3), c VARCHAR(4))

    insert @tableA

    select 1, 'DD', '5' union all 

    select...

  • RE: sequencing a column with group by

    Why did you change the question?

    It is better you start a new topic so other can learn from this too...

  • RE: Column Headers in Subquery?

    SELECT     D.ProjectID,

               H.AttResult ATTResult,

               H.CallDateTime CallDateTime,

               H.CRC CRC,

               D.PhoneNum,

               H.ProjName ProjectName,

               H.ConnectTime ConnectTime,

               D.SourceID,

               D.Field1

    FROM       Dial D

    INNER JOIN (

                   SELECT DialID,

                          MAX(CallDateTime) maxDT

                   FROM   History

               ) z ON z.DialID...

  • RE: Column Headers in Subquery?

    Sorry, my bad!

    The WHERE and the LEFT JOIN should switch places.

    SELECT     D.ProjectID,

               MAX(H.AttResult) ATTResult,

               MAX(H.CallDateTime) CallDateTime,

               MAX(H.CRC) CRC,

               D.PhoneNum,

               MAX(H.ProjName) ProjectName,

               MAX(H.ConnectTime) ConnectTime,

               D.SourceID,

               D.Field1

    FROM       Dial D

    LEFT JOIN  History H...

  • RE: Problem with fixed-length column query from Oracle from SQL server

    What you wrote in last post is not even proper syntax.    

    And why would you try to query Oracle for a constant string when...

  • RE: sequencing a column with group by

    If there are more than 100 items within a group, then just add appriopiate code. Also, if there is substantially less than 100 items in a group, just delete not...

  • RE: Column Headers in Subquery?

    You must set an alias after the paranthesis, like this

    SELECT D.ProjectID,

    (SELECT TOP 1 AttResult as ATTResult FROM History H

    WHERE H.DialID = D.DialID AND H.PhoneNum = D.PhoneNum ORDER BY...

  • RE: i want yesterdays''''record if today''''s

    Maybe it is some kind of corporate publication system, where web publisher uploads new articles for next week on the friday before. That could be new employees, foreign visits, legal...

  • RE: i want yesterdays''''record if today''''s

    and en_date <= @news_date order by en_date DESC

  • RE: Create a text file from SQL data

    And OpenRowSet

  • RE: Speeding up Post code search query

    I don't think it is the database that is the bottleneck of this. Transferring 1.6 million rows to the webpage is!

    If these rows are all combinations of distances, you have only...

Viewing 15 posts - 1,966 through 1,980 (of 2,171 total)