Kristabs Posted July 19, 2006 Report Share Posted July 19, 2006 Kāds ir visvieglākais/ātrāk uzrakstāmais variants, kad pieprasāmais vārds tiek meklēts jebkurā kolonā. Lai nebūtu jāraksta "select ID from tabula where pirmaa_kolona like '%key%' or otraa_kolona like '%key%'". Link to comment Share on other sites More sharing options...
Delfins Posted July 19, 2006 Report Share Posted July 19, 2006 (edited) array + foreach a = (f1,f2,f3) foreach (a => f ) { expr .= (expr ? ' OR ' : '') . f . ' like \'%'.s.'%\''; } sql = select * from table where expr Edited July 19, 2006 by Delfins Link to comment Share on other sites More sharing options...
Kristabs Posted July 19, 2006 Author Report Share Posted July 19, 2006 Šitais bija pirmais, kas man ienāca prāta, bet biju cerējis, ka ir kāds sql variants. Ok, palieku pie šī. Link to comment Share on other sites More sharing options...
Delfins Posted July 20, 2006 Report Share Posted July 20, 2006 Kāds vēl SQL variants? tad raksti storēto procedūru... ja jau gribās bez PHP... Link to comment Share on other sites More sharing options...
Recommended Posts