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.
| Author |
Topic |
|
JTProg
Starting Member
24 Posts |
Posted - 2007-01-19 : 09:24:28
|
| I have an database where I am trapping erros. I want to be able to find the errors that occurr most frequently for particular users so we can perform additional training. How can I compare strings in a query?Example:Wrong StockWrong StockComplete MismatchNot an allowable valueI want the most common error to be returned as Wrong Stock.Query so far:SELECT Max(ErrorDescription)FROM dbo.tblErrorReportWHERE PreparedBy = 'Christine'Order by ErrorDescription ASC |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-01-19 : 09:37:33
|
| select errordescription, count(*)from tblErrorReportwhere preparedby = 'christine'group by errordescriptionorder by 2 desc, errordescriptionPeter LarssonHelsingborg, Sweden |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-01-19 : 09:38:00
|
| You can throw in a TOP 1 or a TOP 1 WITH TIES if you want to.Peter LarssonHelsingborg, Sweden |
 |
|
|
|
|
|