Skip to main content
added 24 characters in body
Source Link
Gerard H. Pille
  • 3.3k
  • 1
  • 9
  • 13
with AD as (
select T.*, rank() over (partition by Agent, customer_id order by date desc) R from tableName T
 /* order by agent, customer_id, date desc */
 )
select * from AD
  where R = 1 and answer = 'Maybe';

See db fiddle

For people trying to answers questions like these, tableconvert comes in handy. Use Import / Markdown.

with AD as (
select T.*, rank() over (partition by Agent, customer_id order by date desc) R from tableName T
 /* order by agent, customer_id, date desc */
 )
select * from AD
  where R = 1 and answer = 'Maybe';

See db fiddle

For people trying to answers questions like these, tableconvert comes in handy.

with AD as (
select T.*, rank() over (partition by Agent, customer_id order by date desc) R from tableName T
 /* order by agent, customer_id, date desc */
 )
select * from AD
  where R = 1 and answer = 'Maybe';

See db fiddle

For people trying to answers questions like these, tableconvert comes in handy. Use Import / Markdown.

Source Link
Gerard H. Pille
  • 3.3k
  • 1
  • 9
  • 13

with AD as (
select T.*, rank() over (partition by Agent, customer_id order by date desc) R from tableName T
 /* order by agent, customer_id, date desc */
 )
select * from AD
  where R = 1 and answer = 'Maybe';

See db fiddle

For people trying to answers questions like these, tableconvert comes in handy.