|
|
SQL queries using "contain"
|
|
I'm struggling with the sytax for an SQL query.
The following does work for an exact match:
SELECT Code,DescriptionLong,BuyMultiple,ReorderQty,OnHandQty,Kit FROM
Inventory
WHERE DescriptionLong = :Filter
I want to select records that contain the given text in one or more fields. Does Delphi support the "contains" keyword for Paradox tables?
If so, how do you implement it?
ANSWER
In SQL you use LIKE so for example
SELECT Code,DescriptionLong,BuyMultiple,ReorderQty,OnHandQty,Kit FROM Inventory WHERE DescriptionLong LIKE :Filter
Filter should use % for wildcards, so %text% would match anything field with the word text in it.
ANSWER
you can use like keyword
WHERE DescriptionLong like '%example string%'
ANSWER-REPLICA
Thanks guys. :-) That works well except it seems to be case sensitive.
I've used lower() in the SQL and :Filter to force it to work and the extra work is not affecting the speed of the query too much. (only 7000 items)
28.01.2005 [Število ogledov: 11] |
|
|