SQL Query Returning First Letter

Posted on 2009-02-10
Last Modified: 2012-06-21
I need an SQL query that distinctly returns the first letter of each value in the column.

Here's an example:

Column A has the following values:  baseball, football, soccer, swimming
The new query would return the following:  b, f, s

I'm using Oracle 10G.
Question by:lcor
    1 Comment
    LVL 73

    Accepted Solution

    select distinct substr(A,1,1) from your_table

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Suggested Solutions

    Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
    The purpose of this article is to demonstrate how we can use conditional statements using Python.
    This video teaches viewers about errors in exception handling.
    The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now