Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 11th, 2004, 08:49 PM
dancesport_warr's Avatar
dancesport_warr dancesport_warr is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 130 dancesport_warr User rank is Lance Corporal (50 - 100 Reputation Level)dancesport_warr User rank is Lance Corporal (50 - 100 Reputation Level)dancesport_warr User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Day 14 h 14 m 36 sec
Reputation Power: 5
count of newly created usernames does not work properly

OK, Im supposed to create a query that makes a username for each employee (specs of username to follow) and shows each username and number of instances of that username (to see if each one is unique).

Specs for username
It should be composed of first 2 chars of first_name, then first 2 chars of last_name, and then last char of last_name.

Now I was able to create the usernames but have trouble displaying the number of each occurrence of a username. I have tried the following but this displays 2 same usernames each with a count of 1... which is not what i want:
Code:
select lower(substr(first_name,1,2) || substr(last_name,1,2) ||
                 substr(last_name,length(last_name),1)),
         count(substr(first_name,1,2) || substr(last_name,1,2) ||         
                  substr(last_name,length(last_name),1))
from employees
group by substr(first_name,1,2) || substr(last_name,1,2) ||
             substr(last_name,length(last_name),1),
             first_name, last_name


Your help is greatly appreciated

Reply With Quote
  #2  
Old November 17th, 2004, 12:45 AM
J@oracle J@oracle is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 11 J@oracle User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Change ur query to....

select lower(substr(first_name,1,2) || substr(last_name,1,2) ||
substr(last_name,length(last_name),1)),
count(substr(first_name,1,2) || substr(last_name,1,2) ||
substr(last_name,length(last_name),1))
from employees
group by lower(substr(first_name,1,2) || substr(last_name,1,2) ||
substr(last_name,length(last_name),1))

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > count of newly created usernames does not work properly


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT