SQLTeam.com | Weblogs | Forums

SQL Query to Pull unique row from table


#1

Hi Guys,
I am new here, Below is sample code. As an example from below, I want one unique records (id,client_id) where amount should be higher.
cREATE TABLE ##TEMP(
ID INT,
Client_ID int
,amount decimal(10,2)
)
insert into ##TEMP
select 1,234,0.00
union
select 1,856,100.00
union
select 1,924,400.00
union
select 2,234,0.00
union
select 2,856,0.00
union
select 2,924,0.00

select * from ##TEMP

Here is final result I am looking
ID,Client_ID,Amount
1,924,400.00
2,234,0.00

I want unique Row by ID, With the highest Rate, If Rates are same or 0.00 pick the lowest client_id

Thank You.


#2
select	*
from
(
	select	* , rn = row_number() over (partition by ID 
						order by amount desc, Client_ID)
	from	##TEMP
) d
where	d.rn	= 1

#3

Hi Khtan,

Great effort and appreciated. That query work perfectly on my above example. I just Pull LIVE/sample below.
I tried to use above query on above LIVE/sample data and it is behaving as suppose to be. Can you take a look sample data for a sec?

Thank You.

CREATE TABLE [dbo].[#t](
[id] [int] NULL,
[client_id] [int] NULL,
[amount] [decimal](10, 2) NULL
) ON [PRIMARY]
GO
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093827, 55966781, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093831, 55966781, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093846, 55966781, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093840, 55966781, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093835, 55966781, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093827, 55966782, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093831, 55966782, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093846, 55966782, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093840, 55966782, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093835, 55966782, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093827, 55966783, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093831, 55966783, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093846, 55966783, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093840, 55966783, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093835, 55966783, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093827, 55966784, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093831, 55966784, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093846, 55966784, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093840, 55966784, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093835, 55966784, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093827, 55966785, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093831, 55966785, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093846, 55966785, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093840, 55966785, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093835, 55966785, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093827, 55966786, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093831, 55966786, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093846, 55966786, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093840, 55966786, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093835, 55966786, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093827, 55966787, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093831, 55966787, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093846, 55966787, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093840, 55966787, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093835, 55966787, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093827, 55966788, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093831, 55966788, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093846, 55966788, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093840, 55966788, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093835, 55966788, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093827, 55966789, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093831, 55966789, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093846, 55966789, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093840, 55966789, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093835, 55966789, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093827, 55966790, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093831, 55966790, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093846, 55966790, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093840, 55966790, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093835, 55966790, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093827, 56132489, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093831, 56132489, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093846, 56132489, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093840, 56132489, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093835, 56132489, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093827, 56132490, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093831, 56132490, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093846, 56132490, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093840, 56132490, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093835, 56132490, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093827, 56150224, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093831, 56150224, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093846, 56150224, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093840, 56150224, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093835, 56150224, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093827, 56150225, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093831, 56150225, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093846, 56150225, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093840, 56150225, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093835, 56150225, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093827, 56150226, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093831, 56150226, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093846, 56150226, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093840, 56150226, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093835, 56150226, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093827, 56150227, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093831, 56150227, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093846, 56150227, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093840, 56150227, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093835, 56150227, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093827, 56150228, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093831, 56150228, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093846, 56150228, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093840, 56150228, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093835, 56150228, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093827, 56150229, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093831, 56150229, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093846, 56150229, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093840, 56150229, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093835, 56150229, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093827, 56150230, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093831, 56150230, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093846, 56150230, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093840, 56150230, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093835, 56150230, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093827, 56150231, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093831, 56150231, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093846, 56150231, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093840, 56150231, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093835, 56150231, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093827, 56150232, CAST(0.00 AS Decimal(10, 2)))
GO
print 'Processed 100 total records'
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093831, 56150232, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093846, 56150232, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093840, 56150232, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093835, 56150232, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093827, 56150233, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093831, 56150233, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093846, 56150233, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093840, 56150233, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093835, 56150233, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093827, 56150234, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093831, 56150234, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093846, 56150234, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093840, 56150234, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093835, 56150234, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093827, 56150235, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093831, 56150235, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093846, 56150235, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093840, 56150235, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093835, 56150235, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093827, 56150236, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093831, 56150236, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093846, 56150236, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093840, 56150236, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093835, 56150236, CAST(0.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093827, 55966771, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093831, 55966771, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093846, 55966771, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093840, 55966771, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093835, 55966771, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093827, 55966772, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093831, 55966772, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093846, 55966772, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093840, 55966772, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093835, 55966772, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093827, 55966773, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093831, 55966773, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093846, 55966773, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093840, 55966773, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093835, 55966773, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093827, 55966774, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093831, 55966774, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093846, 55966774, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093840, 55966774, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093835, 55966774, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093827, 55966775, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093831, 55966775, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093846, 55966775, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093840, 55966775, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093835, 55966775, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093827, 55966776, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093831, 55966776, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093846, 55966776, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093840, 55966776, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093835, 55966776, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093827, 55966777, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093831, 55966777, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093846, 55966777, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093840, 55966777, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093835, 55966777, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093827, 55966778, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093831, 55966778, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093846, 55966778, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093840, 55966778, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093835, 55966778, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093827, 55966779, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093831, 55966779, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093846, 55966779, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093840, 55966779, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093835, 55966779, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093827, 55966780, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093831, 55966780, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093846, 55966780, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093840, 55966780, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093835, 55966780, CAST(100.00 AS Decimal(10, 2)))
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093851, NULL, NULL)
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093828, NULL, NULL)
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093829, NULL, NULL)
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093830, NULL, NULL)
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093832, NULL, NULL)
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093845, NULL, NULL)
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093847, NULL, NULL)
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093848, NULL, NULL)
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093849, NULL, NULL)
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093850, NULL, NULL)
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093839, NULL, NULL)
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093841, NULL, NULL)
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093842, NULL, NULL)
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093843, NULL, NULL)
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093844, NULL, NULL)
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093833, NULL, NULL)
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093834, NULL, NULL)
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093836, NULL, NULL)
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093837, NULL, NULL)
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093838, NULL, NULL)
INSERT [dbo].[#t] ([id], [client_id], [amount]) VALUES (2093852, NULL, NULL)