User Profile

Collapse

Profile Sidebar

Collapse
st33chen
st33chen
Last Activity: Feb 24 '09, 02:48 AM
Joined: Jan 16 '09
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • st33chen
    replied to how to join 2 tables
    hi,

    if i use table1 only, how do i generate
    the records having stk_date between '20081102' and '20081114' ?
    (i only have 3 records -- ie. 20081101, 20081115, 20081121 -- in table1 as described)

    my query string seemed to be (what i tried was more complicated, so i simplified it):
    select table1.stk_no, table2.cal_date , table1.stk_qty
    from table2, table1
    where table2.cal_date =table1.stk_dat e(+)...
    See more | Go to post

    Leave a comment:


  • st33chen
    replied to how to join 2 tables
    sorry, some were mis-typed ( part of "want to get")

    stk_no stk_date stk_qty
    ------ -------- -------
    abcd 20081101 10
    abcd 20081102 10 <-- stk_qty of 20081101
    abcd 20081103 10 <-- stk_qty of 20081101
    ...
    abcd 20081114 10 <-- stk_qty of 20081101
    abcd 20081115 20
    abcd 20081116 20 ...
    See more | Go to post

    Leave a comment:


  • st33chen
    replied to top-n queries
    for example
    Code:
     
    SELECT * 
    FROM (
    SELECT DEPTNO, ENAME, SAL, ROW_NUMBER() OVER(PARTITION BY DEPTNO ORDER BY SAL DESC) TOPN
    FROM SALES
    )
    WHERE TOPN<=1
    See more | Go to post
    Last edited by amitpatel66; Jan 19 '09, 01:38 PM. Reason: code tags

    Leave a comment:


  • st33chen
    replied to Date Between Problem
    i think your SQL statement is :

    SELECT STARTDATE, ENDDATE
    FROM PRONDUTYCOMPOFF
    WHERE STATUS NOT IN('NULLIFIED')
    AND (
    :dt_bgn BETWEEN STARTDATE AND ENDDATE
    OR
    :dt_end BETWEEN STARTDATE AND ENDDATE
    )

    note --> :dt_bgn is the 'START' part of your input
    :dt_end is the 'END' part of your input
    ...
    See more | Go to post

    Leave a comment:


  • st33chen
    started a topic how to join 2 tables

    how to join 2 tables

    hi, all

    if i have 2 tables :

    table1 (stocks)
    Code:
    stk_no  stk_date  stk_qty
    ------  --------  -------
    abcd    20081101       10
    abcd    20081115       20
    abcd    20081121       15
    table2 (calendar)
    Code:
    cal_date  workingday
    --------  ----------
    ...
    20081101  Y
    20081102  Y
    20081103  N
    20081104  N
    ...
    20081130  Y
    ...
    See more | Go to post
    Last edited by pbmods; Jan 16 '09, 03:36 AM. Reason: Added CODE tags.
No activity results to display
Show More
Working...