SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: pl/sql query

  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2006
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question pl/sql query

    hello guys

    could you help me to solve this query in sqlserver

    lets i have a table "bapi" having 6 field like this
    s1 s2 s3 s4 s5
    ... ... .. ... ... ...
    M A T R I

    i want to retrive all the data by using select statement and my output will be look like this:
    xyz
    ...
    M
    A
    T
    R
    I

    Please help urgent

    Thanks

    sarajit

  2. #2
    Just Blow It bronze trophy
    DaveMaxwell's Avatar
    Join Date
    Nov 1999
    Location
    Mechanicsburg, PA
    Posts
    7,263
    Mentioned
    115 Post(s)
    Tagged
    1 Thread(s)
    On first glance, I'd want to know why you're looking to do something like this when it would (most likely) just be easier to do it in code. You're going to be pulling from the same record over and over and over again. A lot a overhead for a simple operation.

    Are you pulling from more than one record? Is there other data involved? All of these things have a major impact on how (or if) you could do this in a single statement.

    But you could do something like this:
    Code:
    SELECT S1 AS xyz FROM bapi where rowID=1
    UNION
    SELECT S2 AS xyz FROM bapi where rowID=1
    UNION
    SELECT S3 AS xyz FROM bapi where rowID=1
    UNION
    SELECT S4 AS xyz FROM bapi where rowID=1
    UNION
    SELECT S5 AS xyz FROM bapi where rowID=1
    UNION
    SELECT S6 AS xyz FROM bapi where rowID=1
    UNION
    SELECT S7 AS xyz FROM bapi where rowID=1
    Dave Maxwell - Manage Your Site Team Leader
    My favorite YouTube Video! | Star Wars, Dr Suess Style
    Learn how to be ready for The Forums' Move to Discourse


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •