How to use the sub string with inner join in Oracle Sql

Hi,

I am trying to use the sub string function with inner join in sql.  How do I implement it with inner join?

For example my queries looks something like this.

"SELECT ATT_NUM, ENT_NUM FROM A INNER JOIN U ON A.ATT_NUM = U.ATT_NUM INNER JOIN E ON E.ENT_NUM = U.ENT_NUM WHERE E.ENT_NAME = '" + _entname + "' AND U.UNIQUENAME '"+ _uniquename + "'", con
where Substring in ('E','C');

Open in new window


Thanks.
developer2012Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

slightwv (䄆 Netminder) Commented:
There seems to be something missing here: AND U.UNIQUENAME '"+ _uniquename + "'"

Like an '=', '>', etc..

What is ,con after that?

There are two WHEREs.

Short of that, there shouldn't be a problem using part of a string in a join.

We just need to know what Substring is?
0
developer2012Author Commented:
con is a connection string(I am using c#.net too).\

I need to retrieve the results where the string starts with E or C
0
developer2012Author Commented:
Extra where is a mistype.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

slightwv (䄆 Netminder) Commented:
select ... where (column_name like 'E%' or coluimn_name like 'C%') and ...

or

... and substr(column_name,1,1) in ('E','C')
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
awking00Commented:
Can you elaborate a little bit more about what you want to accomplish? Are you looking to submit a query through an OracleConnection where the connection string begins with 'E' or 'C'? Can you post more of your C# code?
0
Tomas Helgi JohannssonCommented:
Hi!

Note that using substring on the left side of a comparison in a where clause results in a poor
performance as regular indexes can't be used. Functional indexes gives you some performance
but not as fast as regular indexes.

Regards,
     Tomas Helgi
0
slightwv (䄆 Netminder) Commented:
In this case indexes likely won't matter since the like only uses a single character before the wildcard.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.