Ask Your Question
0

In Base I want to combine Like and And = True

asked 2017-09-13 16:25:35 +0200

Spur52 gravatar image

updated 2017-09-13 16:26:05 +0200

I have a Recipe database. I want to ask two queries at the same time. Ex: Where "Recipe Name" LIKE '%' || :Enter_Word_Using_Caps_For_First_Letter || '%'. This works fine. Now I also want to add AND after this.
Problem is the next query involves finding the True statement from 10 different checkboxes. Above I know it comes from the Recipe Name this one is unknown until the name of the checkbox is entered. I tried And Like together but this did not work.

Frank

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
0

answered 2017-09-13 20:21:44 +0200

Spur52 gravatar image

I don't know what is unclear but will try again. I understand the SELECT and such. It wasn't needed in my question. This is exactly what I have - SELECT * FROM "Recipe Tabletest" WHERE "Recipe Name" LIKE '%' || :Enter_Word_Using_Caps_For_First_Letter || '%' AND ???

The Recipe Name is a query to search for "chicken" for example, and then ask what nationality (the checkbox) is wanted. That is what the ??? is for. I tried AND LIKE '%' || :Enter_Word_Using_Caps_For_First_Letter || '% = TRUE

edit flag offensive delete link more

Comments

Again - When responding to an answer please use comment below the answer responding to, not another answer.

Ratslinger gravatar imageRatslinger ( 2017-09-13 20:34:18 +0200 )edit
0

answered 2017-09-13 17:35:02 +0200

Ratslinger gravatar image

updated 2017-09-13 18:29:37 +0200

Your question is unclear mainly because of incorrect terminology. A query is a Select statement. The part of the query following Where contains conditions. Your LIKE is a condition and it appears you have more conditions to be met for this query and not another query. The documents provided in a previous answered question have samples & explanations.

Typically when you have multiple conditions they are separated by AND or OR and enclosed by parentheses for correct logic such as:

WHERE ("MYFIELD" = 'cake') AND (("Ingredient" = 'flour') OR ("Ingredient" = 'butter'))

How this is grouped together is dependent upon what result you are trying to achieve.

It is also possible you have one query which is dependent upon another query but this too is unclear in the question.

If this answers your question please click on the ✔ (upper left area of answer).

edit flag offensive delete link more

Comments

"Recipe Name" is NOT a query but a CONDITION. It appears you want to retrieve a record based upon an inputted parameter - RecipeName. However, you also want to specify, seemingly by another parameter, what checkbox (nationality) to look at. You can use parameters for values but not for fields. In order to complete what you want, you should create a search form. (continued next comment)

Ratslinger gravatar imageRatslinger ( 2017-09-13 21:03:55 +0200 )edit

The search form is based upon a filter table and a query to use this table along with the actual table to retrieve data from. For a working sample, see Q&A on this post.

Ratslinger gravatar imageRatslinger ( 2017-09-13 21:07:54 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2017-09-13 16:25:35 +0200

Seen: 26 times

Last updated: Sep 13