|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Urgent help needed.
Hi there,
Can anyone help me out of my misery? This SQL statement does not work and i don't know how to fix it: "Select top 50 SID, count(Criteria) as A from ScoreResults where Criteria = -1 and ScoreResults.ID in (Select ID from Player Where FirstName Like '" & strFirstName & "' and LastName Like '" & strLastName & "')order by SID" I am parsing this string through to mssql via VB and get an error and I do not know why. The Error I get is: You tried to excecute a query that does not include the specified expression 'SID' as part of an aggregate function. I am trying to count how often a certain criteria occurs in the last 50 entries of the table. M. |
|
#2
|
||||
|
||||
|
try this
Code:
SELECT TOP 50 SID, COUNT(Criteria) As CriteriaCount
FROM ScoreResults
WHERE Criteria = -1
AND [ID] IN
(
SELECT [ID]
FROM Player
WHERE FirstName LIKE '" & strFirstName & "%'
AND LastName LIKE '" & strLastName & "%'
)
GROUP BY SID
|
![]() |
| Viewing: ASP Free Forums > Database > Microsoft SQL Server > Urgent help needed. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|