Wrox Home  
Search P2P Archive for: Go

  Return to Index  

sql_language thread: Select query


Message #1 by "Catalin Ignat" <cignat@s...> on Thu, 12 Dec 2002 12:49:19 +0200
This query should do it.  It will show each line of the table plus the
number of occurrences of the given name in the table.  Replace "Table1" with
your actual table name.  This works because each row it runs the sub query
(because the t1.name=table1.name clause)

select ID,Name,Description, (select count(*) from table1 t1 where
t1.Name=table1.name)
from table1

Brian Freeman
(xxx) xxx-xxxx  ext. 415
Carnegie Technologies/Bluewave Computing 
www.carnegie.com and www.bluewave-computing.com

-----Original Message-----
From: Catalin Ignat [mailto:cignat@s...]
Sent: Thursday, December 12, 2002 5:49 AM
To: sql language
Subject: [sql_language] Select query


Hello guys,

I have a table with three columns: ID (autonumbered), Name (duplicates
allowed) and Description .
I want to obtain in one query those fields and also another which tells me
for each Name how many records exist.
But the query should return the same records number as it is into the table.

Thanks,
Catalin



  Return to Index