Viewing 15 posts - 1 through 15 (of 40 total)
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
December 16, 2013 at 10:21 pm
What is the expected result from this data?.
December 16, 2013 at 10:08 pm
Hi,
I have edited the query based on the assumption mentioned above.
December 3, 2013 at 2:49 am
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
December 3, 2013 at 2:46 am
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 -...
December 3, 2013 at 2:35 am
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...
December 3, 2013 at 2:33 am
Can I access multiple db from MY SQL using one Linked Server?
November 29, 2013 at 5:32 am
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?
November 28, 2013 at 6:28 am
GilaMonster (10/22/2013)
A float cannot have leading or trailing spaces as it's a numeric data type. Only strings can have leading...
October 23, 2013 at 12:00 am
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...
October 22, 2013 at 11:31 pm
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...
October 22, 2013 at 4:40 am
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...
October 21, 2013 at 5:30 am
Viewing 15 posts - 1 through 15 (of 40 total)