Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql General > FW: finding fir...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 15868 of 17437
Post > Topic >>

FW: finding firstname + lastname groups

by tech@[EMAIL PROTECTED] (Charles Simard) Jun 19, 2008 at 03:56 PM

-> -----Original Message-----
-> From: pgsql-general-owner@[EMAIL PROTECTED]
 Behalf Of blackwater dev
-> Sent: 19 juin 2008 15:38
-> To: pgsql-general@[EMAIL PROTECTED]
> Subject: [GENERAL] finding firstname + lastname groups
->
-> I have to find the same firstname+ lastname combo in my db and see
which
name appears the most so I basically need to do the following:
->
-> select name, count(name) from people group by name having count(name)>1
->
-> The problem is name is not one column but made up of firstname,
lastname...how do I do this?
->
-> Thanks!

Use string concatenation :
http://www.postgresql.org/docs/8.3/interactive/functions-string.html#FUNCTIO
NS-STRING-SQL

select firstname || ' ' || lastname as name, count(firstname || lastname)
	from people
	having count(firstname || lastname) > 1;

Regards,

Charles Simard


-- 
Sent via pgsql-general mailing list (pgsql-general@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
 




 1 Posts in Topic:
FW: finding firstname + lastname groups
tech@[EMAIL PROTECTED] (  2008-06-19 15:56:31 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Nov 22 1:58:49 CST 2008.