Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Query

Status
Not open for further replies.

lalitha1

Programmer
Oct 14, 2008
57
US
I have three tables T1 , T2 , T3.
T1 --- Fname, Lname, usrkey, cert_id, grp_cert_id
T2 --- usrkey,empno
T3 --- usrkey
I am trying to write a query to get the list of all usernames and Groupnames along with empno.
Username = fname + Lname
Groupname = fname + lname if certid = grp_cert_id
Conditions are:
Every username will have a Groupname.
Also one Groupname can have more than one username.
The table looks something like this
Empno Username GroupName
1 John Smith
2 Sara Smith
3 Joe Bob
4 Linda Smith
5 Kathy Bob

I would like to see the result as :
Empno Username GroupName
1,2,4 John Smith
1,2,4 Sara Smith
3,5 Joe Bob
1,2,4 Linda Smith
3,5 Kathy Bob

Any help is appreciated.

 
faq183-4785 <-Clickable

FAQs are a great place to start with this type of question.
If you get something started, and need help getting through a particular issue, please post the code that you have managed to put together.



If [blue]you have problems[/blue], I want [green]source code[/green] AND [green]error messages[/green], none of this [red]"there was an error crap"[/red]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top