Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
List longest unique string for each id
create table my_table (id varchar(4),val varchar(64)); INSERT INTO my_table VALUES('k1', NULL), ('k2', 'Other string'),('k2', 'sneak string'),('k2', NULL),('k3', 'Long string'),('k3', 'string'),('k3', 'sneaky'),('k4',''); select id,min(val) val from my_table t where len(val)=( select max(len(t2.val)) from my_table t2 where t2.id= t.id ) and len(val)>0 group by id
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Hacker - submissions Interview Questions
sssss
Merge Sample Code
TSQL - Logic driven by two most recent rows
Pana la ex 7, inclusiv
on_thi_cuoi_ky
Demo
ASSESSMENT2
get date part from datetime
20181cse0065
Please log in to post a comment.