Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
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
First Query
h
Cinema latinoamericano
heyy
Merge Sample Code
Find effective count of employees within date range for each calendar week
Except Insert missing
Gatoactual
Veterinary 1
Delete cascade