![]() |
Need help in ActiveRecord queries... - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Need help in ActiveRecord queries... (/showthread.php?tid=22419) |
Need help in ActiveRecord queries... - El Forum - 09-09-2009 [eluser]hugle[/eluser] Hello everyone I'm trying to do the search over two mysql tables: table1 > columnt1 and column2 and table2 > columnt1 and column2 Let's take a searchword - "codeigniter" so, when I search the word "Codeigniter", I want the search firstly do smth like that: Code: $keyword = trim("CodeIgniter"); in method I described, I would have smth like 'priority' so if the text matches in col1 and col2 = it's position 1 if only col1 = position2 and if only in col2 = position3 this all should be done agains 2 tables... thanks you very much for any help since I'm very poor at writng such difficult queries ![]() thanks CI community ! Need help in ActiveRecord queries... - El Forum - 09-09-2009 [eluser]kgill[/eluser] Your example query isn't very helpful, you talk about position 1, position 2, but only select id. What columns are you looking to see in the result set, just id? Secondly how are the two tables related, is there a foreign key relationship between them or are they just two separate tables with similar info. That detail makes a huge difference in how the query is written. |