Thread: sql
-
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
-
Is status a constant? Have any sample data and result you like to see?
-
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
-
How do you decide status for each row?
-
the status i defined in the following way;
if the RKEY <> URNO Joined
if the RKEY = URNO Un-Joined
-
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
-
Forum Rules
|
|