Geeks Talk

Prepare for your Next Interview




Query

This is a discussion on Query within the SQL forums, part of the Databases category; What will be the query for this: I have to find the total count of a particular customer ID occuring in a ,say, Sales Table...


Go Back   Geeks Talk > Databases > SQL

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 05-25-2007
Junior Member
 
Join Date: Apr 2007
Posts: 28
Thanks: 0
Thanked 5 Times in 4 Posts
K.K.Rajiv is on a distinguished road
Query

What will be the query for this: I have to find the total count of a particular customer ID occuring in a ,say, Sales Table
Reply With Quote
The Following 2 Users Say Thank You to K.K.Rajiv For This Useful Post:
Sponsored Links
  #2 (permalink)  
Old 05-28-2007
Expert Member
 
Join Date: Jun 2006
Location: India
Posts: 411
Thanks: 15
Thanked 33 Times in 25 Posts
jamesravid is on a distinguished road
Re: Query

it is quite simple,

select cust_id, count(*) from supp
group by cust_id;

the above query displays each cust_id along with number of records in supp table for that custormer id
__________________
Cheers,
:) James:)
Reply With Quote
  #3 (permalink)  
Old 05-29-2007
Junior Member
 
Join Date: May 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
live2learn is on a distinguished road
Re: Query

The above solution gives the count of all customers with the same id....so

select cust_id, count(*) from supp
WHERE cust_id = <>
group by cust_id;
Reply With Quote
Reply

  Geeks Talk > Databases > SQL


Thread Tools
Display Modes


Similar Threads

Thread Thread Starter Forum Replies Last Post
Query jescalante Oracle 4 06-25-2007 03:13 AM
Query with C++ StephenRaj C and C++ 1 08-14-2006 05:09 AM
Query in ASP timmy ASP.NET 1 07-26-2006 04:57 PM
Query on Size scott SQL 0 07-26-2006 04:33 PM
Query with SQL Leading Zero timmy SQL 2 07-17-2006 05:32 PM


All times are GMT -4. The time now is 01:13 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Copyright © 2008 GeekInterview.com. All Rights Reserved