Skip to content

Mapper SQL 쿼리문 작성 #25

@imdayoung

Description

@imdayoung
  • 쿼리문은 대문자로
  • 컬럼명과 변수명은 소문자
  • 각 쿼리문 사이에 띄어쓰기 한줄
  • 가독성을 위해 연산자 사이에 공백 한 칸씩
  • 한 줄씩 띄기
    • SELECT / FROM / WHERE
    • UPDATE / SET / WHERE
    • INSER INTO / VALUES

예시

<select id="getAccountHistoryList" parameterType="int" resultType="AccountConsumptionDTO">
SELECT a.bank_name, a.account_name, a.account_book_image, ah.account_date, ah.account_time,
cat.category_name AS category, ah.content, ah.amount
FROM account_history ah
JOIN account_book a ON ah.account_id = a.id
JOIN category cat ON ah.category = cat.id
WHERE a.member_id = #{memberId}
AND a.conn_status = 1
ORDER BY account_date DESC
</select>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions