New Posts  All Forums:Forum Nav:

Quick SQL Question

post #1 of 3
Thread Starter 
I'm googleing around and not really finding what I am looking for

Say, I have the following table ...

Person_ID Customer
123 Bank
123 STore
123 Car Dealer
123 Manufacturer
111 Hospital
111 Turkey
111 Tire Store



What would i have to do to get it to read

Person: / Number of customers
123 5
111 3



Thanks!
    
CPUMotherboardGraphicsRAM
E6300 @ 2.3 GHz Foxconn Intel x3100 4.5 Rendition 
Hard DriveOptical DriveOSMonitor
160+500 DVDRW Server 08 x64 Princeton 17'' square 
KeyboardPowerCaseMouse
Unicomp Germanic Model M 250W Dell Vostro 200 Gateway Ball Mouse 
  hide details  
Reply
    
CPUMotherboardGraphicsRAM
E6300 @ 2.3 GHz Foxconn Intel x3100 4.5 Rendition 
Hard DriveOptical DriveOSMonitor
160+500 DVDRW Server 08 x64 Princeton 17'' square 
KeyboardPowerCaseMouse
Unicomp Germanic Model M 250W Dell Vostro 200 Gateway Ball Mouse 
  hide details  
Reply
post #2 of 3
SELECT Person_ID AND COUNT(Person_ID) FROM Name_of_table

It's been a while, but it should be something similar to that.
post #3 of 3
Quote:
Originally Posted by hermitmaster View Post

SELECT Person_ID AND COUNT(Person_ID) FROM Name_of_table
It's been a while, but it should be something similar to that.

It's close to 9000 but wrong. First off I've never saw use of count on a column and keyword and in the select clause. 2nd you need a group by clause to select equal rows by a column and group them into a heap.
Try this: select person_id, Count(*) as num from table group by Person_id;
Edited by Recursion - 10/9/12 at 2:20pm
Crayemulator
(34 items)
 
HTPC
(14 items)
 
Laptop
(20 items)
 
CPUMotherboardGraphicsRAM
AMD FX-6100 Asus Sabretooth 990FX rev 2.0 Sapphire R9 290X Tri-X Vulcan DDR3 2400 Orange Series 
Hard DriveHard DriveHard DriveHard Drive
Western Digital Western Digital Samsung Seagate Barracuda 
Optical DriveCoolingCoolingCooling
LG DVD-RW DH16A1L 140 mm Cooltek fan Noctua NF-P12 premium fan Noctua NF-P12 premium fan 
CoolingCoolingCoolingCooling
140 mm Cooltek fan 140 mm Cooltek fan Coolermaster Seidon M120 140 mm Cooltek fan 
CoolingCoolingCoolingCooling
XSPC 420 reservoir and pump Antec Kühler 920 Phobya G-Silent 12 Phobya G-Silent 12 
OSOSMonitorKeyboard
Windows 8.1 Professional OpenSuSE 12.2 22" LG Flatron W2243T Keysonic 
PowerCaseMouseMouse Pad
Be quiet! Straight Power E6 (700W) Corsair Carbide 400R Logitech Gaming Mouse Case Logic Gel-eez 
AudioAudioOtherOther
Samsung 240T Loudspeaker Onboard SATA Y power cable 2x Y 3-pin power cable 
OtherOther
4x S-ATA cable black 50 cm 12volt 4x 3-pin power cable adapter 
CPUMotherboardGraphicsRAM
AMD Phenom 550 2x Biostar TA870+  ATI Radeon HD 4300 Noname Ram 
Hard DriveHard DriveCoolingCooling
Western Digital Caviar Blue Hitach LC Power Cosmo Cool LC-CC95 Arctic Cooler F9 PWM 
CoolingOSMonitorKeyboard
Arctic Cooler F8 PWM Windows 7 Ultimate 27" Acer Noname 
PowerOther
Enermax Pro87+ 500 Watt  3.5" 1.44 MB disk drive  
CPUMotherboardGraphicsGraphics
Turion 64 X2 Ultra  SB 700 series HD 3650 HD 3200 
RAMRAMHard DriveOptical Drive
Komputerbay Noname Samsung Spinpoint M8 Sony DVD/DV-RW TS-L633A 
OSMonitorKeyboardMouse
Windows 8 LG Flatsscreen PS/2 compatible PS/2 compatible 
AudioOtherOtherOther
AMD High Definition Audio Device Bluetooth Adapter Winbond CIR Transceiver IEEE 1394 Firewire 
OtherOtherOtherOther
Qualcomm Atheros AR928X wireless JMicron PCIe MS/SD/MMC/xD Host Controller Realtek PCIe GBE  Logitech 1.3 M WebCam 
  hide details  
Reply
Crayemulator
(34 items)
 
HTPC
(14 items)
 
Laptop
(20 items)
 
CPUMotherboardGraphicsRAM
AMD FX-6100 Asus Sabretooth 990FX rev 2.0 Sapphire R9 290X Tri-X Vulcan DDR3 2400 Orange Series 
Hard DriveHard DriveHard DriveHard Drive
Western Digital Western Digital Samsung Seagate Barracuda 
Optical DriveCoolingCoolingCooling
LG DVD-RW DH16A1L 140 mm Cooltek fan Noctua NF-P12 premium fan Noctua NF-P12 premium fan 
CoolingCoolingCoolingCooling
140 mm Cooltek fan 140 mm Cooltek fan Coolermaster Seidon M120 140 mm Cooltek fan 
CoolingCoolingCoolingCooling
XSPC 420 reservoir and pump Antec Kühler 920 Phobya G-Silent 12 Phobya G-Silent 12 
OSOSMonitorKeyboard
Windows 8.1 Professional OpenSuSE 12.2 22" LG Flatron W2243T Keysonic 
PowerCaseMouseMouse Pad
Be quiet! Straight Power E6 (700W) Corsair Carbide 400R Logitech Gaming Mouse Case Logic Gel-eez 
AudioAudioOtherOther
Samsung 240T Loudspeaker Onboard SATA Y power cable 2x Y 3-pin power cable 
OtherOther
4x S-ATA cable black 50 cm 12volt 4x 3-pin power cable adapter 
CPUMotherboardGraphicsRAM
AMD Phenom 550 2x Biostar TA870+  ATI Radeon HD 4300 Noname Ram 
Hard DriveHard DriveCoolingCooling
Western Digital Caviar Blue Hitach LC Power Cosmo Cool LC-CC95 Arctic Cooler F9 PWM 
CoolingOSMonitorKeyboard
Arctic Cooler F8 PWM Windows 7 Ultimate 27" Acer Noname 
PowerOther
Enermax Pro87+ 500 Watt  3.5" 1.44 MB disk drive  
CPUMotherboardGraphicsGraphics
Turion 64 X2 Ultra  SB 700 series HD 3650 HD 3200 
RAMRAMHard DriveOptical Drive
Komputerbay Noname Samsung Spinpoint M8 Sony DVD/DV-RW TS-L633A 
OSMonitorKeyboardMouse
Windows 8 LG Flatsscreen PS/2 compatible PS/2 compatible 
AudioOtherOtherOther
AMD High Definition Audio Device Bluetooth Adapter Winbond CIR Transceiver IEEE 1394 Firewire 
OtherOtherOtherOther
Qualcomm Atheros AR928X wireless JMicron PCIe MS/SD/MMC/xD Host Controller Realtek PCIe GBE  Logitech 1.3 M WebCam 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming