Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 362339
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T13:14:06+00:00 2026-05-12T13:14:06+00:00

select left(emailaddress, len(emailaddress) – charindex(‘@’, emailaddress)) I am getting the result below: foo@ma Please

  • 0
select left(emailaddress, len(emailaddress) - charindex('@', emailaddress))

I am getting the result below:

foo@ma

Please correct the select statement below. I need to do this with tones of email addresses and extract the username ONLY.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T13:14:06+00:00Added an answer on May 12, 2026 at 1:14 pm

    You’re inadvertently re-implementing “right” there 🙂

    Try this:

    select left(emailaddress, charindex('@', emailaddress) - 1)
    

    It seeks the position of the @, and takes the number of characters up to but not including (that’s the - 1) the @ symbol.

    Be careful with strings that don’t have an @ though; you’ll end up an empty string.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

would someone please explain why select len(0x0a000b) returns 3? does len count bytes? and
SELECT left_tbl.* FROM left_tbl LEFT JOIN right_tbl ON left_tbl.id = right_tbl.id WHERE right_tbl.id IS
Why am I getting ERROR 1222 (21000): The used SELECT statements have a different
I have a query similar to this FROM products AS p, .. LEFT JOIN
i have some mysql script for pivot table and then counting some data inside
Anyone knows a good way to make UNION query in CakePHP? I would like
I'm trying to do a pretty complex query in MySQL ; complex for me,
I have the following UDF. CREATE FUNCTION [dbo].[udf_GenerateVarcharTableFromStringList] (@list varchar(MAX), @delimiter char(1) = N',')
I'd like to make a query where I can retrieve an interval of 10
Using MySQL, I've got a set of tables with 1->N relationships from member ->

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.