Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
5
Erster Beitrag:
vor 8 Jahren, 3 Monaten
Letzter Beitrag:
vor 8 Jahren, 3 Monaten
Beteiligte Autoren:
Art Bonds, issah, M. Beaven, Dan M

What is the wildcard character for a query?

Startbeitrag von Dan M am 11.06.2009 01:57

What I mean is, I have a customer table. I want the user to be able to toggle between ALL customers and just there own.

I created a table based on a query to show just there own.

Is there a character I can use to show ALL by replacing their ID with a character that is a wild card and will show all companies with any ID?

or ... is there another/better way of doing this?

Dan

Antworten:

Hi Dan,

Provided that this is a hyperfile query, you can set the query to use a parameter of customerID. If you want to see all customers, declare the query parameter to be:

myQuery.MyParam=Null

Otherwise, declare the query parameter to be:

myQuery.MyParam=customerID

This is prior to your query execution.

You can "ignore" any query parameter in this sense.

HTH-

Marc

von M. Beaven - am 11.06.2009 04:37
How would one use a wild card in a query where you want to match a certain pattern?

For example, I have a field (TheFieldname) in a table (TableName) made up of numbers, such as:

123456789
123444444
123555559

I want a query to return rows based upon this query: "Select * from TableName where TheFieldname = 123?????9", which would return the first and third row. Or TheFieldname = 12?4?????, where the first and second rows would be returned.

Its on my agenda to look more closely into it this weekend, but if anybody has done this before I'd appreciate a hint. I imagine it depends on which data base I use (HF, MySQL, Postgresql, etc).

von Art Bonds - am 13.06.2009 17:13
I think the SQL default is '%' and '?' but you would normally use 'like' and not '='.
eg.

"Select * from TableName where TheFieldname like '1234%' etc.

Regards

issah

von issah - am 13.06.2009 17:33
So far...

http://www.techonthenet.com/sql/like.php

http://www.sql-tutorial.net/SQL-LIKE.asp

In Postgresql, SIMILAR TO and NOT SIMILAR TO, and for case insensitive also ILIKE and NOT ILIKE.

http://www.postgresql.org/docs/8.3/interactive/functions-matching.html

von Art Bonds - am 13.06.2009 18:35
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.