Results 1 to 6 of 6

Thread: sql

  1. #1
    Join Date
    Apr 2006
    Posts
    3

    sql

    Hi,
    i have a question related to sql
    i need to display a status in my view page but the status feild is not created in the table so how can i display this feild without creating in my database i try this code so can you help me please

    select STOD as STOD_J,FLNO as FLNO_J,ADID AS ADID_J,DES3 AS DES3_J, VIA3 AS VIA3_J,TTYP AS TTYP_J, ETOD AS ETOD_J,OFBL AS OFBL_J, AIRB AS AIRB_J,PSTD AS PSTD_J, ACT3 AS ACT3_J, REGN AS REGN_J, RKEY AS RKEY_J ,'Un Joined',URNO AS URNO_J from AFTTAB WHERE((ADID ='D')AND ((OFBL =' ') OR(AIRB = ' '))AND (URNO = RKEY)) ORDER BY STOD

  2. #2
    Join Date
    Sep 2002
    Posts
    5,938
    Is status a constant? Have any sample data and result you like to see?

  3. #3
    Join Date
    Apr 2006
    Posts
    3
    i want to view the data as following

    Flno ADID Rkey URNO Status
    UL 001 D 101 101 Un-Joined
    ML002 D 102 103 Joined
    SK258 D 104 014 Joined
    SN024 D 114 114 UnJoined

    Note: STATUS IS NOT a feild in the table the table only include FLNO, ADID, RKEY and URNO

  4. #4
    Join Date
    Sep 2002
    Posts
    5,938
    How do you decide status for each row?

  5. #5
    Join Date
    Apr 2006
    Posts
    3
    the status i defined in the following way;
    if the RKEY <> URNO Joined
    if the RKEY = URNO Un-Joined

  6. #6
    Join Date
    Sep 2002
    Posts
    5,938
    In ms sql server, you can use case statement.

Posting Permissions

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