Viewing 15 posts - 8,086 through 8,100 (of 10,144 total)
else x <> 1
But...you can't CASE a part of an expression:
WHERE x = CASE @var = 1 THEN 1 ELSE x END
AND x <> CASE WHEN @var <> 1...
March 11, 2010 at 6:04 am
Vipul Jaba (3/11/2010)
Try this:SELECT
dbo.Product.ProductID,
dbo.Product.Category,
dbo.Product.ProductCode,
dbo.Product.Description,
dbo.Product.Price,
dbo.[Order].CustomerID,
dbo.[Order].OrderID,
dbo.[Order].OrderDate
FROM
dbo.[Order]
INNER JOIN dbo.Product ON dbo.[Order].ProductID = dbo.Product.ProductID
WHERE
convert(datetime,convert(varchar(20),dbo.[Order].OrderDate,106)) = convert(datetime,convert(varchar(20),getdate(),106))
dbo.[Order].OrderDate is no longer SARGable.
The INNER JOIN will lose orders with no...
March 11, 2010 at 3:21 am
Lynn Pettis (3/10/2010)
Paul White (3/10/2010)
Lynn Pettis (3/10/2010)
March 10, 2010 at 8:40 am
Lynn Pettis (3/10/2010)
WHERE ( ord.OrderDate >= DATEADD(dd, DATEDIFF(dd, 0, GETDATE()), 0) AND
...
March 10, 2010 at 7:20 am
GilaMonster (3/10/2010)
Chris Morris-439714 (3/10/2010)
Yes. In Swindon, computers change hands too quickly for any serious development to take place.Sounds like Johannesburg. I'd probably feel right at home there.
Of course, you have...
March 10, 2010 at 7:19 am
Lynn Pettis (3/9/2010)
However, I appreciate the sentiment, thank you! :smooooth:
Lynn Pettis, Most Valuable Parent does it for me.
March 10, 2010 at 7:13 am
Like Lutz, I don't have an answer to why you can't use COUNT().
However, I'd suggest that, since you can't (and shouldn't be able to) use MAX() by design because...
March 10, 2010 at 6:53 am
What about this row?
06 January 2010 |05 February 2010
March 10, 2010 at 5:51 am
Bhuvnesh (3/10/2010)
DECLARE @Ranges_1 TABLE ([ctr] int identity ,
[Id] int NOT NULL,
[varchar](3) NOT NULL,
[dos] int NOT NULL,
[paid] float NOT NULL
)
INSERT INTO @Ranges_1 VALUES (1, '123', '20', '10.75');
INSERT INTO...
March 10, 2010 at 4:50 am
Aeterna (3/10/2010)
CREATE VIEW TodaysOrders
AS
SELECT
prd.ProductID,
prd.Category,
prd.ProductCode,
prd.Description,
prd.Price,
...
March 10, 2010 at 4:00 am
This is the equivalent without using a variable:
SELECT
prd.ProductID,
prd.[Description],
prd.Price,
ord.OrderID,
ord.OrderDate
FROM dbo.[Order] ord
LEFT JOIN dbo.Product prd
ON ord.ProductID = prd.ProductID
WHERE ord.OrderDate = CAST(GETDATE() AS DATE)
March 10, 2010 at 3:26 am
rburke 87921 (3/10/2010)
Forget that last post. I'm being a k*ob!. That works now thankyou very much.
Heh funny! No you're not, you're learning.
Was it the inner join?
March 10, 2010 at 3:13 am
rburke 87921 (3/10/2010)
I probably should have mentioned that I'm trying to create a view. Doesn't seem to like the DECLARE statement.
Why try to turn a query into a view when...
March 10, 2010 at 3:06 am
Stuart Davies (3/10/2010)
Live and work near Swindon, Wilts in the UK(and that is near not in Swindon)
S Hodkinson (3/10/2010)
March 10, 2010 at 3:02 am
Viewing 15 posts - 8,086 through 8,100 (of 10,144 total)