I want to put the bulletin board list number in order

67 Views Asked by At

enter image description here

Hello

I want to put the numbers in order in the bulletin board list.

As you can see, the number is not included in the reply, and the number should be entered only in the original post.

The above bulletin board gave rownum.

How can I make the original article appear in order without omitting the number order?

    SELECT RN, BNO, BNAME, BTITLE, BCONTENT, BDATE, BGROUP, BSTEP, BINDENT,
    COMCNT, ISDEL, HAVEFILE
    FROM
    (SELECT rownum RN, BNO, BNAME, BTITLE, BCONTENT, BDATE, BGROUP, BSTEP, BINDENT, COMCNT,
    ISDEL, HAVEFILE
    FROM ABOARD
    WHERE 1=1
    <if test="key != null &amp;&amp; !key.equals('')">
        AND (BNAME LIKE '%${key}%' OR BTITLE LIKE '%${key}%' OR BCONTENT LIKE
        '%${key}%')
    </if>
    ORDER BY BGROUP DESC, BSTEP ASC)
    WHERE (RN BETWEEN #{start} AND #{end})
    
</select>

table description CREATE TABLE ABOARD(

BNO NUMBER PRIMARY KEY, --PK

BNAME VARCHAR2(10 char) NOT NULL, --writer

BPW VARCHAR2(10 char) NOT NULL, --password

BTITLE VARCHAR2(100 char) NOT NULL, --title

BCONTENT VARCHAR2(1200 char) NOT NULL, --content

BDATE DATE NOT NULL, --date

BGROUP NUMBER NOT NULL, -- reply sequence

BSTEP NUMBER NOT NULL, --reply

BINDENT NUMBER NOT NULL, --reply depth

COMCNT NUMBER, --comment Count

ISDEL CHAR(1) DEFAULT 'N', --is that delete?

HAVEFILE CHAR(1) DEFAULT 'N' --do you have files?

);

View

<c:choose>
            <c:when test="${empty list }">
                <tr>
                    <td colspan="4" align="center">--------------작성된 글이
                        없습니다-----------------</td>
                </tr>
            </c:when>
            <c:otherwise>
                <c:forEach items="${list}" var="dto" varStatus="status">
                            <tr>
                                <td><c:if test="${dto.bstep==0 }">${dto.rn}</c:if><c:if test="${dto.bstep>0 }"> </c:if></td>
                                <c:if test="${dto.isdel=='Y'}"><td colspan="3" style="color: red; font-style: italic;">
                                    삭제된 글입니다.</td></c:if>
                                <c:if test="${dto.isdel=='N'}"><td><c:out value="${dto.bname}" /></td>
                                    <td style="text-align:left; padding-left:${dto.bindent*20}px;"><a
                                        href="detail.do?bno=${dto.bno}&page=${pageProcessing.curPage}"><c:out
                                                value="${dto.btitle}" /></a> 
                                    <span style="color: red;"><small><b>[<c:out value="${dto.comcnt}" />]</b></small></span>
                                    <c:if test="${dto.havefile =='Y'}"><img src="image\attachment.png" style="width:12px; height:12px;"> </c:if>        
                                            
                                            </td>
                                    <td><fmt:formatDate value="${dto.bdate}"
                                            pattern="yyyy/MM/dd HH:mm:ss" /></td></c:if>
                            </tr>
                </c:forEach>
            </c:otherwise>
        </c:choose>
1

There are 1 best solutions below

1
RaviSam On

Update ORDER BY clause in Query to:

ORDER BY rownum, BGROUP DESC, BSTEP

Reference: multiple column ordering