A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

search with multi values and get resaults order



 
 
Thread Tools Display Modes
  #1  
Old December 23rd, 2009, 09:57 AM posted to microsoft.public.access.queries
yuvalbra[_2_]
external usenet poster
 
Posts: 1
Default search with multi values and get resaults order

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

  #2  
Old December 23rd, 2009, 02:07 PM posted to microsoft.public.access.queries
Allen Browne
external usenet poster
 
Posts: 11,706
Default search with multi values and get resaults order

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;

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


"yuvalbra" u57023@uwe wrote in message news:a1030948cd39b@uwe...
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

  #3  
Old December 23rd, 2009, 02:46 PM posted to microsoft.public.access.queries
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default search with multi values and get resaults order

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?

--
Build a little, test a little.


"yuvalbra" wrote:

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

.

  #4  
Old December 23rd, 2009, 09:25 PM posted to microsoft.public.access.queries
yuvalbra via AccessMonster.com
external usenet poster
 
Posts: 2
Default search with multi values and get resaults order

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 DEWEY wrote:
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]

.


--
Message posted via http://www.accessmonster.com

  #5  
Old December 23rd, 2009, 11:08 PM posted to microsoft.public.access.queries
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default search with multi values and get resaults order

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" wrote:

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 DEWEY wrote:
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]

.


--
Message posted via http://www.accessmonster.com

.

  #6  
Old December 24th, 2009, 12:10 PM posted to microsoft.public.access.queries
yuvalbra via AccessMonster.com
external usenet poster
 
Posts: 2
Default search with multi values and get resaults order

Thanks Thanks
I will try it

KARL DEWEY wrote:
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;

I mean:

[quoted text clipped - 30 lines]

.


--
Message posted via http://www.accessmonster.com

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:15 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.