PC Review


Reply
Thread Tools Rate Thread

custom DRW query

 
 
skc
Guest
Posts: n/a
 
      22nd Jun 2004
I have a list of items in my table:

Name Score
John 3
Mike 5
John 3
Ben 4

etc..

I need to filter this list and pick out all the doubles -
so in the list above it will pull out John and his score.

How do I do this using SQL??

skc
 
Reply With Quote
 
 
 
 
Bob Lehmann
Guest
Posts: n/a
 
      22nd Jun 2004
SELECT name, Sum(score) AS TotalScore FROM TableName
WHERE name = 'John'
GROUP BY name

Bob Lehmann


"skc" <(E-Mail Removed)> wrote in message
news:1fdde01c45835$dfed5340$(E-Mail Removed)...
> I have a list of items in my table:
>
> Name Score
> John 3
> Mike 5
> John 3
> Ben 4
>
> etc..
>
> I need to filter this list and pick out all the doubles -
> so in the list above it will pull out John and his score.
>
> How do I do this using SQL??
>
> skc



 
Reply With Quote
 
skc
Guest
Posts: n/a
 
      22nd Jun 2004
I was thinking something like:

SELECT name From Table WHERE If count(name)>2 then show
the name...

I need help with the SQL!

>-----Original Message-----
>SELECT name, Sum(score) AS TotalScore FROM TableName
>WHERE name = 'John'
>GROUP BY name
>
>Bob Lehmann
>
>
>"skc" <(E-Mail Removed)> wrote in

message
>news:1fdde01c45835$dfed5340$(E-Mail Removed)...
>> I have a list of items in my table:
>>
>> Name Score
>> John 3
>> Mike 5
>> John 3
>> Ben 4
>>
>> etc..
>>
>> I need to filter this list and pick out all the

doubles -
>> so in the list above it will pull out John and his

score.
>>
>> How do I do this using SQL??
>>
>> skc

>
>
>.
>

 
Reply With Quote
 
Bob Lehmann
Guest
Posts: n/a
 
      22nd Jun 2004
Obviously!

But, you're going to have to do a better job explaining what you want - The
score?, The name?, both? Do you want to show John's name twice, each with
the corresponding score? Do you just want to show just John's info or all
names where there are duplicates?

Why do you have duplicate names in the table to begin with?

NOTE: Exclamation marks do nothing to increase my sense of urgency. In fact,
I considered not bothering to follow up at all.

Bob Lehmann

"skc" <(E-Mail Removed)> wrote in message
news:1fc9a01c4586e$5097d0b0$(E-Mail Removed)...
> I was thinking something like:
>
> SELECT name From Table WHERE If count(name)>2 then show
> the name...
>
> I need help with the SQL!
>
> >-----Original Message-----
> >SELECT name, Sum(score) AS TotalScore FROM TableName
> >WHERE name = 'John'
> >GROUP BY name
> >
> >Bob Lehmann
> >
> >
> >"skc" <(E-Mail Removed)> wrote in

> message
> >news:1fdde01c45835$dfed5340$(E-Mail Removed)...
> >> I have a list of items in my table:
> >>
> >> Name Score
> >> John 3
> >> Mike 5
> >> John 3
> >> Ben 4
> >>
> >> etc..
> >>
> >> I need to filter this list and pick out all the

> doubles -
> >> so in the list above it will pull out John and his

> score.
> >>
> >> How do I do this using SQL??
> >>
> >> skc

> >
> >
> >.
> >



 
Reply With Quote
 
skc
Guest
Posts: n/a
 
      23rd Jun 2004
Bob,

Apologies for the exclamation mark.

All I want returned is one name which has 2 or more
occurences. I am not concerned with the score for the
time being, but I want the name and the number of
occurences which must be greater than 2.

skc

>-----Orig

inal Message-----
>Obviously!
>
>But, you're going to have to do a better job explaining

what you want - The
>score?, The name?, both? Do you want to show John's name

twice, each with
>the corresponding score? Do you just want to show just

John's info or all
>names where there are duplicates?
>
>Why do you have duplicate names in the table to begin

with?
>
>NOTE: Exclamation marks do nothing to increase my sense

of urgency. In fact,
>I considered not bothering to follow up at all.
>
>Bob Lehmann
>
>"skc" <(E-Mail Removed)> wrote in

message
>news:1fc9a01c4586e$5097d0b0$(E-Mail Removed)...
>> I was thinking something like:
>>
>> SELECT name From Table WHERE If count(name)>2 then show
>> the name...
>>
>> I need help with the SQL!
>>
>> >-----Original Message-----
>> >SELECT name, Sum(score) AS TotalScore FROM TableName
>> >WHERE name = 'John'
>> >GROUP BY name
>> >
>> >Bob Lehmann
>> >
>> >
>> >"skc" <(E-Mail Removed)> wrote in

>> message
>> >news:1fdde01c45835$dfed5340$(E-Mail Removed)...
>> >> I have a list of items in my table:
>> >>
>> >> Name Score
>> >> John 3
>> >> Mike 5
>> >> John 3
>> >> Ben 4
>> >>
>> >> etc..
>> >>
>> >> I need to filter this list and pick out all the

>> doubles -
>> >> so in the list above it will pull out John and his

>> score.
>> >>
>> >> How do I do this using SQL??
>> >>
>> >> skc
>> >
>> >
>> >.
>> >

>
>
>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom Field in Query Slows Query Drastically Larry R Harrison Jr Microsoft Access Queries 1 28th Jan 2005 09:02 PM
Custom query jan Microsoft Access Queries 1 23rd Aug 2004 03:37 PM
Custom SQL Query? =?Utf-8?B?TWF0dCdzIENoYWxsZW5nZS5jb20=?= Microsoft Frontpage 2 20th Aug 2004 01:15 AM
Custom Query Paola Microsoft Access Reports 1 6th Feb 2004 07:03 PM
Custom Query Steve Grosz Microsoft Frontpage 1 9th Jan 2004 08:55 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:59 AM.