hierarchical data - Finding all parents in mysql table with single query on some condition -


next sql working:

select t2.id, t2.name  (     select         @r _id,         (select @r := idparent objects id = _id) parent_id             (select @r := 10) vars,         objects m     @r <> 0) t1 join objects t2 on t1._id = t2.id 

but can find id doing query:

select id objects lower(name) lower('%prod%') 

tell me how combine these queries


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -