Forum Replies Created

Viewing 15 posts - 1 through 15 (of 40 total)

  • RE: Help Making a Query- URGENT

    Hi,

    Try with query

    update table_1 set Comments = SUBSTRING((select ', '+ Comments from table_1 itable

    where itable.RatingID = otable.RatingID and Parameter_Order!=0 for xml path('')),3,1000)

    from table_1 otable where Parameter_Order =0

  • RE: Help Making a Query- URGENT

    What is the expected result from this data?.

  • RE: Same table twice left join issue

    Hi,

    I have edited the query based on the assumption mentioned above.

  • RE: Same table twice left join issue

    Assuming that, month 2 is having data and 1 is not having data for 2~1

    and month 1 is having data and month 2 is not having data for 1~2

  • RE: Same table twice left join issue

    Try with this code

    WITH DATA (Name,marks,month,subject) AS

    (SELECT 'Kumar',80,1,'maths' UNION

    SELECT 'Guna',70,1,'science' UNION

    SELECT 'Kumar',40,2,'physics' UNION

    SELECT 'Kumar',70,3,'physics' UNION

    SELECT 'Guna',40,2,'science')

    select t1.name,ISNULL(t1.marks,0)-ISNULL(t2.marks, 0) as Marks,

    CONVERT(VARCHAR(19),ISNULL(t1.month, '')

    )+'~'+CONVERT(VARCHAR(19),

    case when t2.month is null and t1.month=2 then t1.month -...

  • RE: Same table twice left join issue

    You have used left join for table x and you are applying the WHERE clause.

    Even your query gets the data, it will not meet the WHERE clause condition, so those...

  • RE: Linked Server

    Can I access multiple db from MY SQL using one Linked Server?

  • RE: Linked Server

    This is solved by giving db name in the ODBC.

    Is it any way access the db from MY SQL thru Linked Server, without mentioning the db name in ODBC?

  • RE: Datetime conversion of empty string

    Easy Question

  • RE: Date Functions

    Easy question

  • RE: ltrim rtrim Causing Floating Field to Round up??

    GilaMonster (10/22/2013)


    Why are you trimming a float in the first place?

    A float cannot have leading or trailing spaces as it's a numeric data type. Only strings can have leading...

  • RE: how to write join part of query so that only most recent equipment assignments are returned

    Hi,

    Change the 2nd like this you will get the result

    select

    distinct

    i.iphone_id,

    i.seriel_number,

    lh.Last_Date_Assigned,

    loc.emp_name,

    loc.Department

    from iphones i

    inner join (

    select iphone_id, MAX(date_assigned) as Last_Date_Assigned

    from location_history group by iphone_id

    )lh

    join location_history loch on loch.date_assigned...

  • RE: Avergae Decimal

    james.ingamells (10/22/2013)


    Hi,

    SELECT

    Week,

    Hospital,

    CAST( avg(Length_Of_Stay) AS DECIMAL(10,2)) as Average_LoS

    FROM table

    GROUP BY

    Week,

    Hospital

    This "Length_Of_Stay" might be INTEGER in your table.

    So that AVG function returns INTEGER...

  • RE: Query regarding AVG

    Hi,

    Dwain's query will solve your requirement.

  • RE: Need a Query on group by condition

    Hi try with this

    WITH cte AS

    (

    SELECT

    CAST(RIGHT(monthyear,4) + CASE WHEN LEN(monthyear)=6 THEN LEFT(monthyear,2) WHEN LEN(monthyear)=5

    THEN '0'+LEFT(monthyear,1) END + '01' AS DATE) AS YYYYMMDD,

    emp,

    amount

    FROM @tbl

    )

    SELECT emp, SUM(amount) AS TotalAmount...

Viewing 15 posts - 1 through 15 (of 40 total)