search with multi values and get resaults order

Y

yuvalbra

I work with access 2003
i used the select queries for exampels
select * from tbl where a=val1 or a=val2 or a=val3

i want to get the resalus with this order
* select all values(val1 and val2 and val3)
* select 2 value of the 3 ([val1 and val2] or [val1 and val3] or [val2 and
val3]
* select 1 of the value

the most import is the order of the resualts (its work like Google search)

B/R
Yu
 
A

Allen Browne

To get the count of each result:

SELECT Table1.a,
Count(Table1.ID) AS HowMany
FROM Table1
WHERE Table1.a IN (val1, val2, val3)
GROUP BY Table1.a;
 
K

KARL DEWEY

Your post is confusing. Your select statement indicates 'a' is a field name
but then you want multiple results form the single field.
How do you expect to ever have all values(val1 and val2 and val3) from the
one field?
 
Y

yuvalbra via AccessMonster.com

I mean:

i have table name tbl1 with field1
at that field i have words
like :
field1
word1 want to go there
word2 stay connected with Word1
word3 want to meet word2 and word1
no one here today
the best seller is Word2


the sql for select the three words: word1 word2 word3
will get the resualts in this order
word3 want to meet word2 and word1
word2 stay connected with Word1
word1 want to go there
the best seller is Word2

thats all.
like in google search, i want to see first the resualts of all keys , after
it some of the keys
ant last one of the keys


KARL said:
Your post is confusing. Your select statement indicates 'a' is a field name
but then you want multiple results form the single field.
How do you expect to ever have all values(val1 and val2 and val3) from the
one field?
I work with access 2003
i used the select queries for exampels
[quoted text clipped - 12 lines]
 
K

KARL DEWEY

This does what you ask --
SELECT field1
FROM tbl1
ORDER BY IIF(InStr([field1], [Enter Value1]) >0, 1, 0) + IIF(InStr([field1],
[Enter Value2]) >0, 1, 0) + IIF(InStr([field1], [Enter Value3]) >0, 1, 0)
DESC;

--
Build a little, test a little.


yuvalbra via AccessMonster.com said:
I mean:

i have table name tbl1 with field1
at that field i have words
like :
field1
word1 want to go there
word2 stay connected with Word1
word3 want to meet word2 and word1
no one here today
the best seller is Word2


the sql for select the three words: word1 word2 word3
will get the resualts in this order
word3 want to meet word2 and word1
word2 stay connected with Word1
word1 want to go there
the best seller is Word2

thats all.
like in google search, i want to see first the resualts of all keys , after
it some of the keys
ant last one of the keys


KARL said:
Your post is confusing. Your select statement indicates 'a' is a field name
but then you want multiple results form the single field.
How do you expect to ever have all values(val1 and val2 and val3) from the
one field?
I work with access 2003
i used the select queries for exampels
[quoted text clipped - 12 lines]
 
Y

yuvalbra via AccessMonster.com

Thanks Thanks
I will try it

KARL said:
This does what you ask --
SELECT field1
FROM tbl1
ORDER BY IIF(InStr([field1], [Enter Value1]) >0, 1, 0) + IIF(InStr([field1],
[Enter Value2]) >0, 1, 0) + IIF(InStr([field1], [Enter Value3]) >0, 1, 0)
DESC;
[quoted text clipped - 30 lines]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top