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 2000 Forums
 Transact-SQL (2000)
 match number....

Author  Topic 

tran008
Starting Member

38 Posts

Posted - 2004-10-19 : 16:25:45
hi all,

I need to query the record that have the last 5 number match each other from the following:
xt1669n
xt2670x
th1669n
qt2670x
tq1669n
rt2670x
I try right(record,5) with group by, but it giving me an error: list because it is not contained in either an aggregate function or the GROUP BY clause.

thanks

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-10-19 : 16:27:31
right(record, 5) is the correct approach. You are getting that error because you have additional columns in your select statement that aren't in the group by clause or in an aggregate function. Please post your table structure, sample data, expected result set using the sample data, and the query that was used. We'll be able to rewrite it with that information.

Tara
Go to Top of Page
   

- Advertisement -