If you are looking just for duplicate (ID,vendort_no) combinations, this 
will find them:

SELECT ID, vendor_no, count(1) as dupes
FROM table_name_here
GROUP BY ID, vendor_no
HAVING dupes >1;

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine


Richard Reina <[EMAIL PROTECTED]> wrote on 02/23/2006 12:49:28 PM:

> I's so sorry. You are very correct. The sample data is bad.  ID 
> should be unique. Here it is corrected.
> 
>  |ID    | vendor_no        | date        |
>  |2354  | 578              | "2005-12-23"|
>  |2355  | 334              | "2005-12-24"|
>  |2356  | 339              | "2005-12-26"|
>  |2357  | 339              | "2005-12-26"|
>  |2358  | 339              | "2005-12-26"|
>  |2359  | 445              | "2005-12-26"|
>  |2360  | 522              | "2005-12-27"|
>  |2361  | 522              | "2005-12-27"|
> 
> 
> [EMAIL PROTECTED] wrote: > I am a novice when it come to queries 
> such as this and  was hoping 
> > someone could help me write a query that tells me how many records 
> > have the same ID and vendor number.
> > 
> > |ID    | vendor_no        | date        |
> > |2354  | 578              | "2005-12-23"|
> > |2355  | 334              | "2005-12-24"|
> > |2356  | 339              | "2005-12-26"|
> > |2357  | 339              | "2005-12-26"|
> > |2358  | 339              | "2005-12-26"|
> > |2359  | 445              | "2005-12-26"|
> > |2354  | 522              | "2005-12-27"|
> > |2355  | 522              | "2005-12-27"|
> > 
> > Would I use select count? Any help would be greatly appreciated.
> 
> I'd need a clearer spec to offer advise.  What results would you want
> from the example data?  2354 is there twice but with different vendor
> numbers.  And 522 is there twice with different IDs.  One interpretation
> of "[records with] the same ID and vendor number" is 0 because no record
> has both the same as any other.
> 
> 
> 
> 
> 
> A people that values its privileges above its principles soon loses 
both.
>  -Dwight D. Eisenhower.

Reply via email to