-3

目前我正在为我运行这个查询

SELECT `Sheet1$`.ACCT_CODE, `Sheet1$`.ACCTG_DATE, `Sheet1$`.AGENT_NO, `Sheet1$`.BAL_BOOK_CODE, `Sheet1$`.JRNL_ID_NO, `Sheet1$`.PRODUCT_CODE, `Sheet1$`.SOURCE_SYSTEM_ID, `Sheet1$`.`SUM(DR_CR_AMOUNT)`
FROM `Sheet1$` `Sheet1$`
WHERE (`Sheet1$`.BAL_BOOK_CODE='5092') AND (`Sheet1$`.ACCT_CODE Not Like '%H%') AND (`Sheet1$`.AGENT_NO='943776') OR (`Sheet1$`.BAL_BOOK_CODE='509A') AND (`Sheet1$`.ACCT_CODE Not Like '%H%') AND (`Sheet1$`.AGENT_NO='943776')
ORDER BY `Sheet1$`.ACCT_CODE

该查询给出的结果限于 AGENT_NO='943776'

而我想要显示的结果

  1. ACCT_CODE 不像 '%H%' 和
  2. 如果 AGENT_NO='943776' 那么 BAL_BOOK_CODE='509A' 或 BAL_BOOK_CODE='5092'
  3. 显示所有其他 AGENT_NO
4

1 回答 1

0

选择Sheet1$.ACCTG_DATE、Sheet1$.JRNL_ID_NO、Sheet1$.ACCT_CODE、Sheet1$.SOURCE_SYSTEM_ID、Sheet1$.AGENT_NO、.PRODUCT_CODE Sheet1$Sheet1$.BAL_BOOK_CODE、. 从。 WHERE ( .ACCT_CODE 不像' __H ') AND ( .AGENT_NO<>'943776')Sheet1$SUM(DR_CR_AMOUNT)C:\Documents and Settings\Amit Joshi\Desktop\Book1.xlsxSheet1$ Sheet1$Sheet1$Sheet1$

联合所有

选择Sheet1$.ACCTG_DATE、Sheet1$.JRNL_ID_NO、Sheet1$.ACCT_CODE、Sheet1$.SOURCE_SYSTEM_ID、Sheet1$.AGENT_NO、.PRODUCT_CODE Sheet1$Sheet1$.BAL_BOOK_CODE、. 从。 WHERE ( .BAL_BOOK_CODE='5092') AND ( .AGENT_NO='943776') OR ( .BAL_BOOK_CODE='509A') AND ( .AGENT_NO='943776')Sheet1$SUM(DR_CR_AMOUNT)C:\Documents and Settings\Amit Joshi\Desktop\Book1.xlsxSheet1$ Sheet1$Sheet1$Sheet1$Sheet1$Sheet1$

于 2012-12-14T17:36:22.917 回答