Query Assistance (1 Viewer)

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 05:13
Joined
May 7, 2009
Messages
19,245
PS, back in post #4 you indicated that @arnelgp 's solution didn't work. In #14 you posted a solution with LIKE which isn't what arnel used in his sample db although he never told us what he actually did. I never looked at it earlier because I can't be bothered with "try this" solutions.
the solution is not for you so why bother.
and we are all grown up people here, so there is no need to full elaboration and explanation of what the db is supposed to do.
the OP knows what he/she wants and she finds it on that section of the db.

Sample database posted shows Transaction_Type field has a single word value and only 4 values. My suggestions using IN() or <>"Watch" allow a shorter and simpler SQL.
yes, all the samples are "single" words.
and my proposal was:

In ("Bought","Purchased","Selling")
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 17:13
Joined
Feb 19, 2002
Messages
43,282
And that was exactly the solution proposed by June7 in post #2

The OP though said they were using LIKE which, near as I can tell, no one here suggested and is the least efficient option. Efficiency makes no difference when you have 100 rows of test data but it sure does matter when you have tens of thousands of rows of production data.

@access2010 If you have some answer you are happy with, please mark the thread as solved so we can move on.
 

access2010

Registered User.
Local time
Today, 14:13
Joined
Dec 26, 2009
Messages
1,021
Thank you all for your suggestions.
I was off work while sick and another person tried to correct our problem, without success.

Attached is our updated database with the query.

The field "One Record" = MUST = contain the word "RESEARCH"
Plus if the field "Trade" contains ANY of these words, "BUYING" or "PURCHASED" or "SELLING"
= AND = if the field "Investigate" contains the word "YES"

I am sorry for the mix up.
Nicole
 

Attachments

  • Grouping=23_101.mdb
    296 KB · Views: 74

access2010

Registered User.
Local time
Today, 14:13
Joined
Dec 26, 2009
Messages
1,021
Can you please confirm that this Query is correct?
We would like to print all records if;
A = The Trade field contains any of these words = Buying, Purchased or Selling.
B = If the Trade field does not contain the above words or is empty, but the Investigate field contains Yes

Your assistance has been appreciated.

Nicole
 

Attachments

  • Grouping=23_102.mdb
    328 KB · Views: 65

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 05:13
Joined
May 7, 2009
Messages
19,245
i can confirm that it is correct (db on post#23)
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 17:13
Joined
Feb 19, 2002
Messages
43,282
Your query has THREE criteria. You mentioned only two. Since they are connected with OR, ANY one of them being true will cause a row to be selected.

Also, someone early on mentinone using IN() rather than a series of or's
Your WHERE =
WHERE (((Investments01_tbl.OneRecord_Research)="Research")) OR (((Investments01_tbl.Trade)="Buying" Or (Investments01_tbl.Trade)="Purchased" Or (Investments01_tbl.Trade)="Selling")) OR (((Investments01_tbl.Investigate)=Yes))

It could be:
WHERE (((Investments01_tbl.OneRecord_Research)="Research")) OR (((Investments01_tbl.Trade) In("Buying", "Purchased","Selling")) OR (((Investments01_tbl.Investigate)=Yes))

Which simplifies it.
 

Users who are viewing this thread

Top Bottom