dbTalk Databases Forums  

most frequent part of a field

comp.databases.ms-access comp.databases.ms-access


Discuss most frequent part of a field in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
vjp2.at@at.BioStrategist.dot.dot.com
 
Posts: n/a

Default most frequent part of a field - 07-28-2009 , 01:19 PM






how would I get the most frequent part of a feild (telephone cntrex).

I have some idea how to use "ORDER BY COUNT DESC LIMIT 1" but what if I
want to compare the first seven characters (ie, area code and
exchange) instead of the entire number?


- = -
Vasos Panagiotopoulos, Columbia'81+, Reagan, Mozart, Pindus, BioStrategist
http://www.facebook.com/vasjpan2
---{Nothing herein constitutes advice. Everything fully disclaimed.}---
[Homeland Security means private firearms not lazy obstructive guards]
[Urb sprawl confounds terror] [Remorse begets zeal] [Windows is for Bimbos]

Reply With Quote
  #2  
Old   
Salad
 
Posts: n/a

Default Re: most frequent part of a field - 07-28-2009 , 02:17 PM






vjp2.at (AT) at (DOT) BioStrategist.dot.dot.com wrote:
Quote:
how would I get the most frequent part of a feild (telephone cntrex).

I have some idea how to use "ORDER BY COUNT DESC LIMIT 1" but what if I
want to compare the first seven characters (ie, area code and
exchange) instead of the entire number?

Just like one would do entering an expression in the querybuider
...Left(Phone,7) as AreaPrefex, ....
or entering in a blank column
AreaPrefix : Left(Phone,7)
Assumes the field's name is phone

Quote:
- = -
Vasos Panagiotopoulos, Columbia'81+, Reagan, Mozart, Pindus, BioStrategist
http://www.facebook.com/vasjpan2
---{Nothing herein constitutes advice. Everything fully disclaimed.}---
[Homeland Security means private firearms not lazy obstructive guards]
[Urb sprawl confounds terror] [Remorse begets zeal] [Windows is for Bimbos]

Reply With Quote
  #3  
Old   
vjp2.at@at.BioStrategist.dot.dot.com
 
Posts: n/a

Default Re: most frequent part of a field - 07-28-2009 , 03:34 PM



Many thanks.. BTW I was hoping to get only one value.. so I can build a pivot table..
(else 3d!)


- = -
Vasos Panagiotopoulos, Columbia'81+, Reagan, Mozart, Pindus, BioStrategist
http://www.facebook.com/vasjpan2
---{Nothing herein constitutes advice. Everything fully disclaimed.}---
[Homeland Security means private firearms not lazy obstructive guards]
[Urb sprawl confounds terror] [Remorse begets zeal] [Windows is for Bimbos]

Reply With Quote
  #4  
Old   
Salad
 
Posts: n/a

Default Re: most frequent part of a field - 07-28-2009 , 04:12 PM



vjp2.at (AT) at (DOT) BioStrategist.dot.dot.com wrote:
Quote:
Many thanks.. BTW I was hoping to get only one value.. so I can build a pivot table..
(else 3d!)

Add DISTINCT

Select Distinct fieldlist from Table...

Or make it a GroupBy/Totals query.
Quote:
- = -
Vasos Panagiotopoulos, Columbia'81+, Reagan, Mozart, Pindus, BioStrategist
http://www.facebook.com/vasjpan2
---{Nothing herein constitutes advice. Everything fully disclaimed.}---
[Homeland Security means private firearms not lazy obstructive guards]
[Urb sprawl confounds terror] [Remorse begets zeal] [Windows is for Bimbos]

Reply With Quote
Reply




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 On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.