Forum Replies Created

Viewing 15 posts - 166 through 180 (of 1,923 total)

  • RE: SQL help to CONCATENATE column values

    Attachments missing..

    Also can you please clarify th eexpected result ?

  • RE: Changing Data type from char to numeric

    Phil Parkin (5/1/2012)


    select ISNUMERIC('Tandoori chicken') [NotNumeric], ISNUMERIC(55.99999) [Numeric]

    I LOVE 'Tandoori chicken' :w00t:

  • RE: join

    Oops, Sean beat me to it, a long time ago ... 😀

  • RE: join

    This?

    ;with contacts as

    (

    select c.* , rn = ROW_NUMBER() over (partition by client order by dates desc )

    from contact c

    )

    select clt.client_name , ctc.phone

    from client clt

    join contacts ctc

    ...

  • RE: divide column by primary and secondary

    Can you please read this ASAP? --> How to post your questions[/url]

  • RE: SQL Query to show previous and next date?

    Even more compact

    select t.event , Frst = MAX (t.event_date) , min(CrsApp.mn)

    from mytable t

    cross apply (

    ...

  • RE: retrieve only month and year (last two digits) part of datetime field

    How about this?

    Sample data:

    declare @Date table ( dt datetime)

    insert @Date select '2011-10-07 13:18:48.720'

    insert @Date select '2011-07-26 15:46:16.407'

    insert @Date select '2011-12-26 15:46:16.407'

    insert @Date ...

  • RE: UPDATE statement using SELECT

    Why dont you delete (or truncate) the table and then insert the output?

    You are trying to randomize each row , create new combinations and replace each row.. So why not...

  • RE: changing columns value to field names

    We can.. but tell me this, if there were more than one non-null value for each comment, wchich one should be used for pivoting?

    And also, do u always only 4...

  • RE: SQL Query to show previous and next date?

    One another way:

    declare @inputdt date = '2012-04-10' ;

    ; with Edge1 as

    (

    select t.event ,Frst = MAX (t.event_date)

    from mytable t

    where t.event_date < @inputdt

    group by t.event

    )

    ,Edge2...

  • RE: String extraction

    How about this?

    DECLARE @Table Table ( String VARCHAR(100))

    insert into @Table values

    ('/Customer Service2/CS Team - CareFirst Connect')

    ,('/Enrollment Analyst/Enrollment Analyst 1')

    ,(' /Enrollment Technician/Enrollment Technician 9/Enrollment Technician 8')

    SELECT...

  • RE: help on SQL

    sqlfriends (5/1/2012)


    Thank you, ColdCoffee,

    It works perfectly.

    The function seems a very useful one

    Please forward your thanks to the poster above me, who invented it 😀

    And the previous poster is ----> Jeff...

  • RE: help on SQL

    This?

    SELECT P.Product_id , CrsApp.Item , PD.description

    FROM Product P

    CROSS APPLY dbo.DelimitedSplit8K (P.Category , ',') CrsApp

    JOIN Prod_desc PD

    ON CrsApp.Item = PD.Category

    ORDER BY CrsApp.Item ,P.Product_id , ...

  • RE: Changing Data type from char to numeric

    This works for me

    select Admission_Exam , AVG(cast( Admission_Exam_Score as float))

    from Admission_Exam_Test

    group by Admission_Exam

    Wat error are you gettig?

  • RE: Aggregating counts and getting cumulative counts by date

    Amazing work posting all the needed information! Awesome.

    IS this what u were looking for?

    ; with GroupedData AS

    (

    Select

    RN = ROW_NUMBER() over (partition by empid order by AddDate)

    ,EmpID

    ,AddDate

    ,count(recid)as daylyCount

    from...

Viewing 15 posts - 166 through 180 (of 1,923 total)