Viewing 15 posts - 1,036 through 1,050 (of 2,171 total)
Also asked and answered here
March 27, 2008 at 2:34 am
Try this
SELECTd.Name
FROM(
SELECTf1.Name,
MIN(f1.Region) AS minRegion,
MAX(f1.Region) AS maxRegion,
SUM(CASE WHEN f2.Name IS NULL THEN 1 ELSE 0 END) AS Nulls,
COUNT(*) AS Items
FROM@Fruit AS f1
LEFT JOIN@Fruit AS f2 ON f2.Name = f1.Name
AND f2.Sequence =...
March 26, 2008 at 10:27 am
If I change this line
select 3, 'nut', 1, 'hard to crack' union all
to
select 3, 'nut', 2, 'hard to crack' union all
it fails too...
March 26, 2008 at 9:34 am
Try thisSELECTf1.Name
FROM@Fruit AS f1
LEFT JOIN@Fruit AS f2 ON f2.Name = f1.Name
AND f2.Sequence = f1.Sequence
AND f2.Description = f1.Description
AND f2.Region <> f1.Region
GROUP BYf1.Name
HAVINGSUM(CASE WHEN f2.Name IS NULL THEN 1 ELSE 0 END)...
March 26, 2008 at 3:36 am
Already asked and answered here
March 26, 2008 at 2:45 am
SELECTCategoryID,
Category,
CASE
WHEN Category LIKE 'Fema%Jewel%OB' THEN 'Female Accessories Own Brand'
WHEN Category LIKE 'Fema%Jewel%Brand%' THEN 'Female Accessories Outside Brand'
WHEN Category LIKE 'Fema%Und%wear%Brand%' THEN 'Womenswear Outside Brand'
WHEN Category LIKE 'Male%Accs%OB' THEN 'Male Accessories...
March 26, 2008 at 2:42 am
If only digits are allowed, try this
SELECT*
FROMTable1
WHERECol1 NOT LIKE '%[^0-9]%'
March 26, 2008 at 2:33 am
Sarvesh Kumar Gupta (3/14/2008)
March 14, 2008 at 2:50 am
Other than this?DELETEf
FROM(
SELECTROW_NUMBER() OVER (PARTITION BY Col1 ORDER BY Col2 DESC) AS RecID
FROMTable1
) AS f
WHEREf.RecID > 1
March 14, 2008 at 2:47 am
Well, Sarvesh is not entirely correct.
You can use GROUP BY to sort out duplicate values. In most cases GROUP BY is more efficient than DISTINCT to do that because GROUP...
March 14, 2008 at 1:34 am
First tell me which part of Books Online about DISTINCT and GROUP BY you didn't understand, and I can maybe tell you some more.
March 13, 2008 at 4:06 am
SELECT
SUM(CASE WHEN ve < 0 THEN ve ELSE 0 END) AS Negative,
SUM(CASE WHEN ve > 0 THEN ve ELSE 0 END) AS Positive
FROM Table1
March 10, 2008 at 8:59 am
Thank you!
It's nice to see someone recognize the simpicity of the algorithm structure.
You are absolutely correct about the quick start, to only change the insert thingy with SELECT .. GROUP...
March 7, 2008 at 10:04 am
March 4, 2008 at 4:37 pm
Viewing 15 posts - 1,036 through 1,050 (of 2,171 total)