Ask Your Question
0

Base Queries - How can i use AND (not OR) between criterias of a column. [closed]

asked 2013-12-13 09:06:57 +0200

ratrace gravatar image

updated 2015-03-14 20:10:33 +0200

Hello,

i made a querie that is based in two tables, that are related. In the querie's design view, i want to set multiple criterias (two criterias), that should be connected with AND not OR.

What i am trying to achieve is to see the results, for records that have both the tags "tag1" AND "tag2". I don't want to see records that have one of the tags "tag1" OR "tag2", but only those that have both "tag1" AND "tag2".

How can i do that?

Thank you

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by Alex Kemp
close date 2015-11-16 16:52:39.047944

Comments

very helpful post.

ratrace gravatar imageratrace ( 2015-03-14 20:08:58 +0200 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2013-12-13 22:33:44 +0200

frofa gravatar image

Without knowing much about your tables/columns, only an example query is possible:

SELECT "table1_text" FROM "table1" WHERE "tag1_column" = 'tag1' AND "tag2_column" = 'tag2'

NOTE: It is assumed that the columns "tag1_column" and "tag2_column" are BOTH in a table called "table1" and you want to output values of another column in this table called "table1_text" satisfying your tag conditions (but, of course, this may NOT be your setup). Please provide more info about your tables/columns if you want further help.

edit flag offensive delete link more

Comments

Thank you for your answer,

some more details for my problem.

I have the TABLE "POL" that has the fields "a/a","pol","tags". "a/a" is an autocompleted integer and primary key, "pol" is a small int and a foreign key, and "tags" is a varchar.

Let's say that in TABLE "POL" i have three records. "1-1105-income", "2-1105-vat","3-1106-capital".

How can i design a query that will give me the records that have both vat AND income tags? The result should be 1-1105-income", "2-1105-vat".

Thank you

ratrace gravatar imageratrace ( 2013-12-15 13:34:08 +0200 )edit

Question Tools

1 follower

Stats

Asked: 2013-12-13 09:06:57 +0200

Seen: 167 times

Last updated: Dec 13 '13