Loading ...
Sorry, an error occurred while loading the content.
 

sql query ?

Expand Messages
  • rajafaisal09
    Hello , well i have a problem in SQL n tht is ... i have a column cantainning names of students in any institute ...now i have to write a query tht should
    Message 1 of 4 , Jul 4 5:32 AM
      Hello ,
      well i have a problem in SQL n tht is
      ... i have a column cantainning names of students in any
      institute ...now i have to write a query tht should give me numeric
      answer for the characters present in a students name
      suppose i would like a charcter 'A'

      Alen = 1 should be displayed
      AAbias = 2
      Micheal = 1
      Missy = 0

      any ideas how can i do this in a query

      Bye
    • Michael Gerholdt
      The solution to this might vary significantly depending upon which vendor product you are using. Oracle? Sybase? MS SQL Server? etc
      Message 2 of 4 , Jul 4 9:28 AM
        The solution to this might vary significantly depending upon which vendor
        product you are using.

        Oracle?
        Sybase?
        MS SQL Server?
        etc


        > Hello ,
        > well i have a problem in SQL n tht is
        > ... i have a column cantainning names of students in any
        > institute ...now i have to write a query tht should give me numeric
        > answer for the characters present in a students name
        > suppose i would like a charcter 'A'
        >
        > Alen = 1 should be displayed
        > AAbias = 2
        > Micheal = 1
        > Missy = 0
        >
        > any ideas how can i do this in a query
        >
        > Bye
      • Faisal Raja
        Well I was looking the solution in Oracle Actually But thanks for replying i have got the solution now Thanks a lot it will be like Select length(name) -
        Message 3 of 4 , Jul 4 11:48 AM
          Well I was looking the solution in Oracle Actually
          But thanks for replying i have got the solution now Thanks a lot
          it will be like
                      Select length(name) - length( replace(name,'A',' ' ))  Name
                       from student ;
          Well i have got solution like this , If any one know its solution other way round to then plz share it
          Thanks to all

          Michael Gerholdt <gerholdt@...> wrote:
          The solution to this might vary significantly depending upon which vendor
          product you are using.

          Oracle?
          Sybase?
          MS SQL Server?
          etc


          > Hello ,
          > well i have a problem in SQL n tht is
          > ... i have a column cantainning  names of students in any
          > institute ...now i have to write a query tht should give me numeric
          > answer for the characters present in a students name
          > suppose i would like a charcter 'A'
          >
          > Alen = 1 should be displayed
          > AAbias = 2
          > Micheal = 1
          > Missy = 0
          >
          > any ideas how can i do this in a query
          >
          > Bye





          Do you Yahoo!?
          Yahoo! Mail is new and improved - Check it out!

        • Michael Gerholdt
          Faisal, This is a very clever solution! Remember to upper the name prior to replace since Oracle is by default case sensitive. select length(name) -
          Message 4 of 4 , Jul 4 9:46 PM
            Faisal,

            This is a very clever solution!

            Remember to upper the name prior to replace since Oracle is by default case
            sensitive.

            select length(name) - length(replace(upper(name),'A','')) numChars
            from student

            Regards,
            Michael Gerholdt
            SUNY College at Fredonia
            ----- Original Message -----
            From: "Faisal Raja" <rajafaisal09@...>

            > Well I was looking the solution in Oracle Actually
            > But thanks for replying i have got the solution now Thanks a lot
            > it will be like
            > Select length(name) - length( replace(name,'A',' ' )) Name
            > from student ;
            > Well i have got solution like this , If any one know its solution other
            way round to then plz share it
            > Thanks to all

            >
            > > Hello ,
            > > well i have a problem in SQL n tht is
            > > ... i have a column cantainning names of students in any
            > > institute ...now i have to write a query tht should give me numeric
            > > answer for the characters present in a students name
            > > suppose i would like a charcter 'A'
            > >
            > > Alen = 1 should be displayed
            > > AAbias = 2
            > > Micheal = 1
            > > Missy = 0
            > >
            > > any ideas how can i do this in a query
          Your message has been successfully submitted and would be delivered to recipients shortly.