0

Table 1:

id    name    desc     start date     end date
----------------------------------------------
1     a       abc        1/2/2010    
2     b       def        2/4/2012     2/2/2016
3     c       adf        3/1/2015     
4     d       dde        2/2/2011     3/3/2012

if the end date is given or submited by user I jus want to see the output as

   id    name    desc     start date     end date
    ----------------------------------------------

    1     a       abc        1/2/2010 

    3     c       adf        3/1/2015   
Barbaros Özhan
  • 59,113
  • 10
  • 31
  • 55

2 Answers2

1

Select * from table where end_date is null

would give you the answer in your example

SCJohnson243
  • 141
  • 5
  • use 4 spaces at the front of each line of code/data/error msgs OR highlight a block of text and use the `{}` format tool at the top left of the edit box to format as `code/data/output/errorMsgs`. For more info see [editing-help](https://stackoverflow.com/editing-help) and [formatting](https://stackoverflow.com/help/formatting). Good luck. – shellter Jan 31 '18 at 19:02
1

The below query would give the results of the table where end date is null

Select * from tablename
where enddate is null;
  • if Suppose is my start date is connected to end date ..suppose we using a case statement like CASE WHEN startdate= 'somevalue' THEN 1 ELSE NULL END –  Jan 31 '18 at 19:27
  • select case when startdate = sysdate then 1 else null end from tablename; Or you could also add a date to the start date select case when startdate = to_date('01/02/2010','mm/dd/yyyy') then 1 else null end from tablename – praveen muppala Jan 31 '18 at 19:37
  • what does your answer distinguish from the answer that SCJohnson243 posted 40 minutes before your answer? – miracle173 Jan 31 '18 at 19:42
  • I did not see the answer which was provided. You can disregard this if you do not want to – praveen muppala Jan 31 '18 at 20:21