+ Start a Discussion
Rahul Singh 1384Rahul Singh 1384 

I want to query details of those accounts whose name has numeric value on 2nd place.

Hi Everyone,

Someone please help me, to Query Any records which contains any numeric value on 2nd place.
For eg: I have 7 accounts with name : 

UnitedAccount,
B12Account,
c13Account,
e6account,
BerlingtonAccount,
75account,
p18TestAccount etc.

I want to query details of those accounts whose name has numeric value on 2nd place.
So, output should be for these accounts:

B12Account,
c13Account,
e6account,
71account,
p18TestAccount

So, what query can i write to fetch these accounts details?
Any help would be greatly appreciated.
SHAHNA MULLASHAHNA MULLA
Hi Rahul,

If you want to use just SOQL, you must create a formula field on your account object, as follows :
IF(ISNUMBER(RIGHT( LEFT( Name , 2) , 1)), "yes", "no")
Then do the following query :
select name,id,status__c from account where status__c='yes'
[ Here "status__c" is the formula field ]

Can you please Let me know if it helps or not!!!

If it helps don't forget to mark this as a best answer!!!