473,385 Members | 1,317 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

sql statement wildcard in fieldname

I am trying to search for a field where the wildcard needs to be in
the field name i.e.:

select * from userlist where fun??? = true order by lasNam, firNam

However, Access won't let me do this. Can anyone help show me how to
do this?

Thanks.
Nov 12 '05 #1
5 3023
I don't think that's doable, but I can't say for sure it's not.
(Someone else will have to jump in to say for sure.)

How many "fun*" fields are there? If there are not too many, you
could use a WHERE clause like:
WHERE [funA = true] OR [funB = true]

-Matt
On 8 Dec 2003 23:11:09 -0800, da******@myrealbox.com (Dan Hardy)
wrote:
I am trying to search for a field where the wildcard needs to be in
the field name i.e.:

select * from userlist where fun??? = true order by lasNam, firNam

However, Access won't let me do this. Can anyone help show me how to
do this?

Thanks.


Nov 12 '05 #2
Dou you meant you have, for example, 3 Field named:

fun001
fun002
fun003

and you want the Query to select the Record if

[fun001] = True And/Or
[fun002] = True And/Or
[fun003] = True
?

In this case, it is NOT possible. You can see that I don't even know
whether you meant AND or OR. Perhaps, you should set up the Query like:

WHERE [fun001] = True
OR [fun002] = True
OR [fun003] = True

I would also suggest you check out your Table Structure against the
Relational Database Design Principles. One of the principles / rules /
normal forms is that you should not have repeating groups and the way you
named the Fields and selected Records in the Query seem to indicate that you
have repeating groups (of 1 Field in each group) in your Table.

--
HTH
Van T. Dinh


"Dan Hardy" <da******@myrealbox.com> wrote in message
news:bf**************************@posting.google.c om...
I am trying to search for a field where the wildcard needs to be in
the field name i.e.:

select * from userlist where fun??? = true order by lasNam, firNam

However, Access won't let me do this. Can anyone help show me how to
do this?

Thanks.

Nov 12 '05 #3
Van,

Thanks for your help. You're right that I screwed up in the
normalization, but the database is not big enough for me to really
worry about it.

Basically, what I want it
IF fun001 = TRUE THEN
do this

ELSE IF fun002 = TRUE
do this
etc.

It's for an asp website. Any more thoughts? Otherwise it won't be
too much trouble for me just to do the above.

Thanks.

Dan Hardy

"Van T. Dinh" <Va***********@PlseUseNewsGroup.bigpond.com> wrote in message news:<Og*****************@news-server.bigpond.net.au>...
Dou you meant you have, for example, 3 Field named:

fun001
fun002
fun003

and you want the Query to select the Record if

[fun001] = True And/Or
[fun002] = True And/Or
[fun003] = True
?

In this case, it is NOT possible. You can see that I don't even know
whether you meant AND or OR. Perhaps, you should set up the Query like:

WHERE [fun001] = True
OR [fun002] = True
OR [fun003] = True

I would also suggest you check out your Table Structure against the
Relational Database Design Principles. One of the principles / rules /
normal forms is that you should not have repeating groups and the way you
named the Fields and selected Records in the Query seem to indicate that you
have repeating groups (of 1 Field in each group) in your Table.

--
HTH
Van T. Dinh


"Dan Hardy" <da******@myrealbox.com> wrote in message
news:bf**************************@posting.google.c om...
I am trying to search for a field where the wildcard needs to be in
the field name i.e.:

select * from userlist where fun??? = true order by lasNam, firNam

However, Access won't let me do this. Can anyone help show me how to
do this?

Thanks.

Nov 12 '05 #4
I am not sure about "do this" and "do that" in a Query. Queries normally
returns (sets of) values, not actions.

If you want to return values, perhaps you can create a UDF (User-Defined
Function) and use this UDF to return the value you want. Something like:

****Pseudo code only****
Public Function fnReturnValue _
( ByVal fFun001 As Boolean, _
ByVal fFun002 As Boolean, _
... ) As
RequiredReturnType

If fFun001 = True Then
fnReturnValue = ...
ElseIf = True Then
fnReturnValue = ...
...
Else

End If

End Function
********

--
HTH
Van T. Dinh
MVP (Access)

"Dan Hardy" <da******@myrealbox.com> wrote in message
news:bf**************************@posting.google.c om...
Van,

Thanks for your help. You're right that I screwed up in the
normalization, but the database is not big enough for me to really
worry about it.

Basically, what I want it
IF fun001 = TRUE THEN
do this

ELSE IF fun002 = TRUE
do this
etc.

It's for an asp website. Any more thoughts? Otherwise it won't be
too much trouble for me just to do the above.

Thanks.

Dan Hardy


Nov 12 '05 #5
Sorry, I missed the part about "asp web site". My answer is for an Access
application.

Since you use the database / MDB file to store data only (hence you are
using a JET database, NOT really an Access database), I am not sure how you
can implement the equivalent of the UDF in ASP.

--
HTH
Van T. Dinh
MVP (Access)

"Dan Hardy" <da******@myrealbox.com> wrote in message
news:bf**************************@posting.google.c om...
Nov 12 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Andrew Banks | last post by:
Can anyone see anything obviously wrong with this statement? I'm not really an SQL kind of guy SELECT ProductID, Title FROM Products WHERE PlatformID LIKE % AND CategoryID =...
2
by: CES | last post by:
All, I sorry for the 101 question but how do you combine 2 var into a document statement i.e. This Line works:
5
by: Joe | last post by:
Here are some of the values in my table: AW-3002-12, DM-2002-12, MS-4221-01, MS-1003-32, etc. I want to have a list that will sort this items regardless the three first charachters. So, the new...
1
by: Law.Win | last post by:
I have an IIF statement in the criteria of a query. I would like to know how to use a wildcard with the varaibles inside it. For example IIF(, , ) I would like the wildcard after variable 2. ...
4
by: Darryn Ross | last post by:
Hi, I am trying to execute a SQL statement that has the 'LIKE' condition in it, i am reading from a access 2002 database and when i build my statement i am trying to include the '%' wildcard and...
2
by: crjunk | last post by:
I'm trying to write a piece of code that will programatically save a record automatically without me having to add a new ' Row.Item("ADD1") = txtAdd1.Text.Trim.ToUpper ' type command each time I...
2
by: Anandan | last post by:
Hi, In our Project we use Dataset to load the Grid with Values. We have some criteria to filter the values to be shown in the Grid. For that we used the SELECT command to filter the Same...
5
by: Zammy | last post by:
I'm guessing this has been explained before, but I can not seem to phrase the search correctly. I am trying to use a string (strString) in a VBA select query. I want to include the * wildcard in...
4
by: =?Utf-8?B?UmljaA==?= | last post by:
Is it possible to use a wildcard like feature with Dataview.Find? Actually, I tried that but did not get any rows. Is there some wildcard like feature of the dataview or some other object that I...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.