goma smile Posted March 27, 2013 Report Share Posted March 27, 2013 Iedomājieties datubāzes tabulas kollonā glabājās implodēti id piemēram pattern_id = 1,2,3,4,5,6,7 ,bet es vēlos lai vaicājums pārbauda vai pattern_id šūnās norādītā skaitļu virtne sakristu ar kādu no skaitļiem kkā ta WHERE `pattern_id` IN ('6, 5, 4, 3, 2'), Quote Link to comment Share on other sites More sharing options...
ezis Posted March 27, 2013 Report Share Posted March 27, 2013 http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_find-in-set http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_locate Quote Link to comment Share on other sites More sharing options...
goma smile Posted March 27, 2013 Author Report Share Posted March 27, 2013 Es visu laiku meiģinu ar FIND IN SET bet neiet... Quote Link to comment Share on other sites More sharing options...
marrtins Posted March 27, 2013 Report Share Posted March 27, 2013 Kāds find in set? Kur tur ir set? Tur ir string. Attiecīgi meklē ar string f-ijām. Quote Link to comment Share on other sites More sharing options...
codez Posted March 27, 2013 Report Share Posted March 27, 2013 šeit prasās pēc normalizācijas.Izveido tabulu: objects_patterns-----object_idpattern_id un katram objekta priekš katra paterna izveido ierakstu.Tālāk atlase jau pavisam vienkārša. SELECT * FROM objects_patterns op LEFT JOIN objects o ON op.object_id=o.id WHERE op.pattern_id IN (2,4,6,7,8) Quote Link to comment Share on other sites More sharing options...
goma smile Posted March 28, 2013 Author Report Share Posted March 28, 2013 šeit prasās pēc normalizācijas. Izveido tabulu: objects_patterns ----- object_id pattern_id un katram objekta priekš katra paterna izveido ierakstu. Tālāk atlase jau pavisam vienkārša. SELECT * FROM objects_patterns op LEFT JOIN objects o ON op.object_id=o.id WHERE op.pattern_id IN (2,4,6,7,8) Jā paldies - Cepums atrisināts :) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.