Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 what's wrong

Author  Topic 

neil_akoga
Yak Posting Veteran

56 Posts

Posted - 2009-08-12 : 09:01:21
is there any reason this is wrong. my query window in visual studio keeps saying that > is not recognised

SELECT entityName AS Company, CASE CAST(numberOFStaff AS int)
WHEN numberOFStaff >=1 and numberOFStaff <=5 THEN '1 - 5'
WHEN numberofStaff >=6 and numberOfSTaff <=20 then '6-20'
END AS staffQuantity
FROM atblEntity
ORDER BY Company

vijayisonly
Master Smack Fu Yak Hacker

1836 Posts

Posted - 2009-08-12 : 09:18:08
[code]SELECT entityName AS Company,
CASE
WHEN CAST(numberOFStaff AS INT) >= 1
AND CAST(numberOFStaff AS INT) <= 5
THEN '1 - 5'
WHEN CAST(numberOFStaff AS INT) >= 6
AND CAST(numberOFStaff AS INT) <= 20
THEN '6-20'
END AS staffQuantity
FROM atblEntity
ORDER BY Company[/code]
Go to Top of Page

neil_akoga
Yak Posting Veteran

56 Posts

Posted - 2009-08-12 : 09:20:39
cheers mate, you're a life saver
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-08-12 : 09:21:10
[code]SELECT entityName AS Company,
CASE
WHEN CAST(numberOFStaff AS INT) BETWEEN 1 AND 5 THEN '1 - 5'
WHEN CAST(numberOFStaff AS INT) BETWEEN 6 AND 20 THEN '6 - 20'
END AS staffQuantity
FROM atblEntity
ORDER BY Company[/code]


N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page
   

- Advertisement -