--- On Thu, 12/2/10, Tiemo Hollmann TB <[email protected]> wrote: > Hi, > > I need a very basic SQL SELECT with 1 up to 7 fields > (f1-f7) to be selected, > like (reduced form): > > SELECT * FROM myTable WHERE > > f1=s1 > > AND f2=s2 > > AND f3=s3 > > ... > > AND f7=s7 > > The user can use only one field or any combination of up to > 7 fields for > selecting. > > From coding point of view the easiest solution would be > just one SQL > statement including all 7 fields and filling all not used > parameters with > "%". But this is not very performant. So I should have only > those fields in > my SQL string, which are actually used (depending on the > user selection). To > do this I have to check in 7 "if-clauses" what is selected > and depending on > that concat my resulting SQL string with only those fields > needed. > > Is this the old fashioned standard approach, or am I not > seeing a more > sophisticated way with less coding? > > Thanks > > Tiemo >
You may want to take a look at the TicketExampleApplication that I used for my RunRevLive'09 presentations: <http://www.quartam.com/downloads/tea.zip> It contains a helper library for constructing SQL queries from parameters passed in via arrays. HTH, Jan Schenkel. ===== Quartam Reports & PDF Library for LiveCode www.quartam.com ===== "As we grow older, we grow both wiser and more foolish at the same time." (La Rochefoucauld) _______________________________________________ use-livecode mailing list [email protected] Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
