Viewing 15 posts - 586 through 600 (of 627 total)
Try this:
SELECT
u.USERID,
u.NAME,
u.PHONE,
ui1.INFO AS Sport,
ui2.INFO AS Food
FROM
[User] u
JOIN UserInfo ui1 ON u.USERID = ui1.USERID AND ui1.COLUMN = 10
JOIN UserInfo ui2 ON u.USERID = ui2.USERID AND ui2.COLUMN = 30
April 14, 2015 at 7:35 am
You need to realize that there are NO duplicates in your sample output. The different DocumentID's make the rows completely unique no matter how much other data appears to...
April 14, 2015 at 7:07 am
Try using the CASE statements in the top level SELECT.
April 13, 2015 at 2:11 pm
Start here:
http://www.sqlservercentral.com/stairway/72399/
The stairway articles here are a great resource...but essentially a Clustered Index IS your table.
April 13, 2015 at 11:31 am
river1 (4/13/2015)
I have a view named SGSCC
If I call it as select * from SGSCC it works fine
If I try to call it as select * from sgcc says that...
April 13, 2015 at 7:43 am
Sean Lange (4/10/2015)
This is wrong on a couple of levels. The first is...
April 10, 2015 at 12:51 pm
Sorry I used the wrong date in the APPLY. It should have been this:
SELECT
DATEPART(wk, t.date) AS [Week],
t.*,
x.Sales52
FROM #Test t
OUTER APPLY
(
SELECT SUM(sales) AS Sales52
FROM #Test
WHERE
([Date] BETWEEN DATEADD (wk, -52, t.date)AND...
April 10, 2015 at 11:36 am
...or you can cheese it a bit and do
SELECT * FROM #TEST
SELECT
t.EmpCode,
oa.TimeIn,
t.Time AS [TimeOut]
FROM
#TEST t
OUTER APPLY(
SELECT MAX(Time) AS TimeIn FROM #TEST WHERE [TIME] < t.TIME AND [In/OUT] = 'TRUE'
) oa
WHERE
t.[In/Out]...
April 10, 2015 at 10:18 am
This will get you most of the way.
SELECT
t.EmpCode,
oa.TimeIn,
t.Time AS [TimeOut]
FROM
#TEST t
OUTER APPLY(
SELECT MAX(Time) AS TimeIn FROM #TEST WHERE [TIME] < t.TIME AND [In/OUT] = 'TRUE'
) oa
WHERE
t.[In/Out] = 'FALSE'
AND EmpCode =...
April 10, 2015 at 9:47 am
Are you looking for something like this?
WITH Last52 (Market, Item, Sales52)
AS
(
SELECT
Market,
Item,
SUM(sales) AS Sales52
FROM
#Test
WHERE
[Date] BETWEEN DATEADD (wk, -52, Date)AND GETDATE()
GROUP BY
Market,
Item
)
SELECT
DATEPART(wk, t.date) AS [Week],
t.*,
l.Sales52
FROM #Test t
JOIN Last52 l ON l.Market...
April 10, 2015 at 7:33 am
Shouldn't have any reason to move the step. Just apply the logging to the one in question.
Maybe try restarting the Agent and running again. I've seen my share...
April 10, 2015 at 7:08 am
Well the only thing left that I can think of is I sometimes forget to DROP or DELETE my temp tables when I testing some code. Maybe you ran...
April 9, 2015 at 2:13 pm
Yes, that is correct...see easy to make a typo. 😉
Hmmm...if it didn't return anything that is strange.
April 9, 2015 at 1:16 pm
How many steps do you have in your job and which one is reporting an error? The logging is applied to each step individually, so you'll need to make...
April 9, 2015 at 12:49 pm
Your select statement that you posted doesn't guarantee unique values for OrderID.
Just for fun just try:
SELECT
tinclude.OrderId,
COUNT(tinclude.OrderId)
FROM
( SELECT v.OrderId FROM dbo.mdv_CustomerFilterCustomerTransDate v WITH (NOLOCK)
WHERE v.TerritoryCode IN (3) AND v.CustomerId...
April 9, 2015 at 12:05 pm
Viewing 15 posts - 586 through 600 (of 627 total)