Connecting Tech Pros Worldwide Forums | Help | Site Map

Help with counting occurances of similar text

remove
Guest
 
Posts: n/a
#1: Nov 13 '05
Hi all,

I have a fairly simple database containing details of broadcast news
reports. Each record contains information about the programme title, date,
time, presenter, and details of the interviewees (if any) who contributed to
a particular report.

What I need to be able to do is count up instances of repeated text within
the database. For example, I would like to be able to run a query which
would provide a list of all the various programme presenters, and how many
reports they each presented.

e.g.

John Humphrys 54
Sarah Montague 56
Mark Coles 22


I also need to set up a more complex query, relating to interviewees and
guests. Contributors to each separate news report are set out in this
format:

Contributor1_N: Name of Interviewee
Contributor1_P: Political Party
Contributor1_IS: Interview or Soundbite

Contributor2_N: Name of Interviewee
Contributor2_P: Political Party
Contributor2_IS: Interview or Soundbite


(There is space for up to eight separate contributors, all set out in the
same way).

How would I, for example, write a query which gives a total for contributors
from, say, the Labour Party? Presumably I would have to somehow add up
occurrences of the phrase 'Labour Party' from Contributor1_P to
Contributor8_P ….

I think what might suit me best would be a query which would list every
possible input in all of the eight Contributor_P categories , and give a
total next to it.

e.g.

Labour Party 65
Conservative Party 54
Liberal Democrats 26
Green Party 1
Scottish National Party 1

I realise I've probably constructed the database poorly in the first place,
but would very much appreciate it if anyone could offer me some help,
explained in very simple terms if possible.

Many thanks

Andrew, (Brighton, UK)

Nick Coe \(UK\)
Guest
 
Posts: n/a
#2: Nov 13 '05

re: Help with counting occurances of similar text


Have a look at the 'like' operator in Access Help. Used in
a query that should get a result set which you can then use
the Count() function on.

Do it in stages, design the query to get the results you
want then muck about with count() to get the numbers you
want. Count() is in the help as well.

Good luck

--
Nick Coe (UK)
Available - Will work for money :-)
http://www.alphacos.co.uk/ AccHelp + pAnimal
http://www.pjandcoe.co.uk/ Online Store

In news:n_udnTfiTc_2RojeRVnyjA@giganews.com,
remove ntlworld.com typed:[color=blue]
> Hi all,
>
> I have a fairly simple database containing details of
> broadcast news reports. Each record contains information
> about the programme title, date, time, presenter, and
> details
> of the interviewees (if any) who contributed to a
> particular
> report.
>
> What I need to be able to do is count up instances of
> repeated
> text within the database. For example, I would like to be
> able to run a query which would provide a list of all the
> various programme presenters, and how many reports they
> each
> presented.
>
> e.g.
>
> John Humphrys 54
> Sarah Montague 56
> Mark Coles 22
>
>
> I also need to set up a more complex query, relating to
> interviewees and guests. Contributors to each separate
> news
> report are set out in this format:
>
> Contributor1_N: Name of Interviewee
> Contributor1_P: Political Party
> Contributor1_IS: Interview or Soundbite
>
> Contributor2_N: Name of Interviewee
> Contributor2_P: Political Party
> Contributor2_IS: Interview or Soundbite
>
>
> (There is space for up to eight separate contributors, all
> set
> out in the same way).
>
> How would I, for example, write a query which gives a
> total
> for contributors from, say, the Labour Party? Presumably
> I
> would have to somehow add up occurrences of the phrase
> 'Labour
> Party' from Contributor1_P to Contributor8_P ..
>
> I think what might suit me best would be a query which
> would
> list every possible input in all of the eight
> Contributor_P
> categories , and give a total next to it.
>
> e.g.
>
> Labour Party 65
> Conservative Party 54
> Liberal Democrats 26
> Green Party 1
> Scottish National Party 1
>
> I realise I've probably constructed the database poorly in
> the
> first place, but would very much appreciate it if anyone
> could
> offer me some help, explained in very simple terms if
> possible.
>
> Many thanks
>
> Andrew, (Brighton, UK)[/color]


Closed Thread