Hi all! I would like to do a form in which the user can edit few words (separated by a blank character). When the user press the "Search" button I would like to use those words to search in a field of a table. I have done it but I have two problems: 1) I use sqlgroup but I can use it just with the = and not with the LIKE statement select * from annunci <dtml-sqlgroup where> <dtml-sqltest Parola column=testo type=string optional> </dtml-sqlgroup> the result is: select * from annunci where Parola="Word" but I would like this result: select * from annunci where Parola LIKE "%Word%" 2) I am not able to divide the words in more conditions. I would like the following result: select * from annunci where testo LIKE "%FirstWord%" and testo LIKE "%SecondWord%" Thank you in advance, Cesare Cesare Raoss Planning srl Via Bolzano 45 38014 Gardolo (TN) cesare@planningsrl.it http://www.planningsrl.it
try this: select * from annunci where testo like '<dtml-var "'%' + firstword + '%'">' and testto like '<dtml-var "'%' + secondword + '%'">' cheers jim cesare@planningsrl.it wrote:
Hi all!
I would like to do a form in which the user can edit few words (separated by a blank character).
When the user press the "Search" button I would like to use those words to search in a field of a table.
I have done it but I have two problems:
1) I use sqlgroup but I can use it just with the = and not with the LIKE statement select * from annunci <dtml-sqlgroup where> <dtml-sqltest Parola column=testo type=string optional> </dtml-sqlgroup>
the result is:
select * from annunci where Parola="Word"
but I would like this result:
select * from annunci where Parola LIKE "%Word%"
2) I am not able to divide the words in more conditions. I would like the following result: select * from annunci where testo LIKE "%FirstWord%" and testo LIKE "%SecondWord%"
On Wed, 12 Jan 2000 15:28:30 GMT cesare <cesare@planningsrl.it> wrote:
1) I use sqlgroup but I can use it just with the = and not with the LIKE statement select * from annunci <dtml-sqlgroup where> <dtml-sqltest Parola column=testo type=string optional> </dtml-sqlgroup>
Read the "ZSQL MEthods User's Guide" and look in the back at the "op=XXX" support in dtml-sqlquery. You can use "op=LIKE" per that doc.
2) I am not able to divide the words in more conditions. I would like the following result: select * from annunci where testo LIKE "%FirstWord%" and testo LIKE "%SecondWord%"
Again, see the above doc, and look at the examples using dtml-sqlgroup, dtml-and, and dtml-or. They show you how to do what you want. -- J C Lawrence Home: claw@kanga.nu ----------(*) Other: coder@kanga.nu --=| A man is as sane as he is dangerous to his environment |=--
participants (3)
-
cesareļ¼ planningsrl.it -
J C Lawrence -
JB