TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Janine
NA
8
41.8k
Returns double values
Jan 7 2011 3:16 AM
Hi am writing a sql query that should return multiple values from mulitple tables, that part works (whoopee) but it is returning the same employee multiple times. One of the values I am returning contains many similarites in them form example "BankAL, BankAAL, BankALE, BankALC, BankDTE" Lets say these are different Bank categories. Now an Employee can belong to just one of these categories, or all of them, or just some of them.
The user of this proc knows the Bank part, thats constant. So they just want the first two characters displayed after Bank. eg. "AL, AA, DT" This can be done, but I am assuming I am getting multiple values or the same employee multiple times because one employee can belong to BankAL and BankALC, even though I am displaying only AL, i think it still reads both and therefore would display the employee twice. (like I said, I think)
This is the case statement I am using to only select the "AL" part, but it doesn't sort out the problem
@SQL
=
@SQL
+
'CASE WHEN OEMPBANK.BankID LIKE ''Bank%'' THEN IsNull(SUBSTRING(OEMPBANK.BankID , 5, 2),'' '') ELSE ' ' END
As you can imagine this is sensitive info so cant post too much code
Reply
Answers (
2
)
Need help with a SQL select
STORED PROCEDURE ERROR