divide column by primary and secondary

  • hello friends

    i have task

    teacheridtlnametfnameschoolidschoolname

    2 john smith 152 carnegi

    2 john smith 155 monroville

    1 ricky johnston153 elementery

    3 ricky johnston157 alleghany

    1 steve ulman 151 banksville

    1 steve ulman 154 school

    1 steve ulman 156 pittsburgh

    i get this result by this query

    select t.teacherid,t.tlname,t.tfname, t.schoolid, s.schoolname from teacher t join school s on

    t.schoolid = s.schoolid order by t.tlname,t.tfname

    and i need result display like this

    teacherid tlnametfnameschoolidsecondary_schoolID schoolname

    2 john smith 152 carnegi

    2 john smith 155 monroville

    1 ricky johnston153 elementery

    3 ricky johnston 157 alleghany

    1 steve ulman 151 banksville

    1 steve ulman 154 school

    1 steve ulman 156 pittsburgh

    so please help me

  • Can you please read this ASAP? --> How to post your questions[/url]

  • From what you posted, nope.

    Please read the first article I reference below in my signature block. It will walk you through what we need and how to post it.

  • Please elaborate your question

  • see

    one teacher

    teacher school code

    steve ulman 151

    steve ulman 158

    steve ulman 159

    so i need to display as

    teacher primary_schoolcode secondary_school code

    steve ulman 151 158

    159

    The new field needs to have a blank or empty string for the first record and all other records have the value ‘Secondary’

    thats my question

  • surma.sql (5/2/2012)


    see

    one teacher

    teacher school code

    steve ulman 151

    steve ulman 158

    steve ulman 159

    so i need to display as

    teacher primary_schoolcode secondary_school code

    steve ulman 151 158

    159

    The new field needs to have a blank or empty string for the first record and all other records have the value ‘Secondary’

    thats my question

  • thanks to edit my question

    but please give me solution

  • surma.sql (5/2/2012)


    thanks to edit my question

    but please give me solution

    Hey, I needed to see what is what first. Please don't get impatient. We are volunteers.

  • surma.sql (5/2/2012)


    thanks to edit my question

    but please give me solution

    And to help us out, how about showing us what you have tried so far.

  • sorry friend

    i don't know how to do.

    please help me

  • All you need to do is cut and paste the code you have already written in an attempt to solve your problem. It would help to see what you have tried.

  • this is the query

    select t.tlname,t.tfname, t.schoolid, s.schoolname from teacher t join school s on

    t.schoolid = s.schoolid

    result

    tlnametfnameschoolidschoolname

    steveulman151banksville

    johnsmith152carnegi

    rickyjohnston153elementery

    steveulman154school

    johnsmith155monroville

    steveulman156pittsburgh

    rickyjohnston157alleghany

    i need

    tlnametfnameschoolidsecondary schoolname

    steveulman 151 banksville

    154 school

    156 pittsburgh

    johnsmith 152 carnegi

    155 monroville

    rickyjohnston 153 elementery

    157 alleghany

    please help me

  • Did u alteast read the article me and Lynn pointed?

  • surma.sql (5/2/2012)


    this is the query

    select t.tlname,t.tfname, t.schoolid, s.schoolname from teacher t join school s on

    t.schoolid = s.schoolid

    result

    tlnametfnameschoolidschoolname

    steveulman151banksville

    johnsmith152carnegi

    rickyjohnston153elementery

    steveulman154school

    johnsmith155monroville

    steveulman156pittsburgh

    rickyjohnston157alleghany

    i need

    tlnametfnameschoolidsecondary schoolname

    steveulman 151 banksville

    154 school

    156 pittsburgh

    johnsmith 152 carnegi

    155 monroville

    rickyjohnston 153 elementery

    157 alleghany

    please help me

Viewing 14 posts - 1 through 13 (of 13 total)

You must be logged in to reply to this topic. Login to reply