Ok, here's what i am struggeling with.I have a table like this;CREATE TABLE [dbo].[myTable] ( [id] [int] IDENTITY (1, 1) NOT NULL , [catId] [int] NULL , [uid] [int] NULL , [amount] [money] NULL ) ON [PRIMARY]GO
CatId holds the different category Id'suid holds the userId's from another tableamount holds different sorts of amountslet's say you insert the following data1) insert into myTable(catId, uid, amount) VALUES(1,1,'1.20')2) insert into myTable(catId, uid, amount) VALUES(1,2,'1.20')3) insert into myTable(catId, uid, amount) VALUES(1,3,'1.21')4) insert into myTable(catId, uid, amount) VALUES(1,4,'1.43')5) insert into myTable(catId, uid, amount) VALUES(1,5,'1.45')6) insert into myTable(catId, uid, amount) VALUES(1,6,'1.45')
What i like to get back is only the row, where col amount is unique (in this case that would be row 3 and 4) WITH the user ID.I came up with a first thing like;select amount, count(*)from myTablewhere catId = 1group by amounthaving count(*) < 2
But that doesn't give me the user Id of the row. If i throw in the uid in this group/having select the rows get unique again.Hope somebody can help me out here :)thnxs in advance!