Viewing 12 posts - 1 through 12 (of 12 total)
I would go for
select OrderId from OrderDetails where ProductId=1
intersect
select OrderId from OrderDetails where ProductId=2;
September 20, 2019 at 1:28 pm
... and did those 124 who gave the correct answer get their point after all?
May 3, 2019 at 5:35 am
Hi!
What is the data type of Ratio? If it is "int" and between 0 and 100 the result of the division will always be 0. Try and replace "Ratio/100" by...
June 10, 2015 at 8:35 am
The name of getdate() is somewhat misleading as it returns datetime. For your WHERE clause to work you will have to replace getdate() by cast(getdate() as date).
November 20, 2014 at 7:26 am
Just to get you started: have look at the DATEADD function (http://msdn.microsoft.com/de-de/library/ms186819.aspx).
You can make use of the fact that 0 corresponds to 01-01-1900.
A final hint: The last day of the...
October 15, 2014 at 3:55 am
Is this what you are looking for
select MONTH(bill_date), YEAR(bill_date),SUM(travel),SUM(fixed),SUM(food),SUM(lodge)
from dbo.expense
group by MONTH(bill_date), YEAR(bill_date)
order by MONTH(bill_date), YEAR(bill_date)
Difficult to know if that's what you want as your sample data don't seem to...
May 19, 2014 at 12:46 am
Hi,
In your second 'SELECT ...' the comma after the NULL is missing.
April 11, 2014 at 7:04 am
The answer is only correct is ANSI_NULLS is ON. With ANSI_NULLS off one obtains 2,4,5.
March 27, 2014 at 12:30 am
Hi, mickyT!
Your method only works if the number of rows is a multiple of 5. Try and remove the ('J',1) and your bottom 20 per cent has only one record.
September 20, 2013 at 6:09 am
The error is in the three updates: You can't use an alias for the expression on the right-hand side of the '='.
September 3, 2013 at 6:12 am
In this case you can use "distinct":
update R
set Mask=(select sum(distinct POWER(@Big2, D.Dept)) from @Depts D where D.CustomerNum = R.CustomerNum)
from @Result R
November 16, 2011 at 7:47 am
Bitwise ORing powers of 2 is just like adding them. You can try this:
update R
set Mask=(select sum(POWER(@Big2, D.Dept)) from @Depts D where D.CustomerNum = R.CustomerNum)
from @Result R
November 16, 2011 at 7:42 am
Viewing 12 posts - 1 through 12 (of 12 total)