As you’ve noticed, the WHERE
clause doesn’t allow you to use aggregates in it. That’s what the HAVING
clause is for.
HAVING t1.field3=MAX(t1.field3)
More Related Contents:
- Is it possible to write single query on two table which are not connected to each other?
- Get top 1 row of each group
- SQL update query using joins
- How to update two tables in one statement in SQL Server 2005?
- Referring to a Column Alias in a WHERE Clause
- SQL query to select dates between two dates
- Convert Month Number to Month Name Function in SQL
- Create a date from day month and year with T-SQL
- SET versus SELECT when assigning variables?
- Selecting COUNT(*) with DISTINCT
- Generate a resultset of incrementing dates in TSQL
- Getting result of dynamic SQL into a variable for sql-server
- How to get difference between two rows for a column field?
- Better techniques for trimming leading zeros in SQL Server?
- SQL – Subtracting a depleting value from rows
- How to print VARCHAR(MAX) using Print Statement?
- What’s the best way to select the minimum value from several columns?
- Concatenate values based on ID
- Splitting delimited values in a SQL column into multiple rows
- SELECT FOR UPDATE with SQL Server
- varbinary to string on SQL Server
- SQL Server 2005 ROW_NUMBER() without ORDER BY
- Can an INNER JOIN offer better performance than EXISTS
- OPENXML with xmlns:dt
- SQL Server : SUM() of multiple rows including where clauses
- Cumulative Total in MS Sql server [duplicate]
- Use variable with TOP in select statement in SQL Server without making it dynamic [duplicate]
- Compare dates in T-SQL, ignoring the time part
- Memory effective way to read BLOB data in C#/SQL 2005
- When to use EXCEPT as opposed to NOT EXISTS in Transact SQL?