SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: query display

  1. #1
    SitePoint Addict aniltc's Avatar
    Join Date
    Nov 2006
    Location
    INDIA
    Posts
    399
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    query display

    hi
    I have a table called person and 4 filelds in that.
    namely id,name,stat and status

    id - primary key
    name- name of a person
    stat-this contains two values (either 1 0r 2)
    status-this contains two values ( either 0 or 1)

    this is how my table looks now.
    **************************************
    id name stat status
    1 ab 1 1
    2 cn 1 1
    3 bnc 1 1
    4 ab 2 1
    5 bc 1 1
    6 vc 1 0
    ***************************************
    so i want to display my table as
    ####################################
    id name stat status
    1 ab 1 1
    3 bnc 1 1
    5 bc 1 1
    2 cn 1 1
    4 ab 2 1
    6 vc 1 0
    ####################################

    i have written the query as select * from person where status!=0 order by stat
    But name filed is geeting as

    name
    ab
    cn
    bnc
    bc
    ab
    please help me

  2. #2
    SitePoint Zealot malluwood's Avatar
    Join Date
    Nov 2006
    Posts
    114
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try this

    select * from person where stat <=2 and status!=0 order by stat,name

  3. #3
    SitePoint Addict aniltc's Avatar
    Join Date
    Nov 2006
    Location
    INDIA
    Posts
    399
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks wood it works!!!!!!!!!!!!!!!!!!


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
  •