SELECT top 2 * FROM [bak_db_xbr].[xbr_1_raw].[T_RI_EVENT]
WHERE store_id='PSH088'
SELECT * FROM [db_xbr].[xbr_1_raw].[T_RI_TRANSACTION]
WHERE store_id='PSH088' and business_date='2010-03-15 00:00:00.000'
and terminal_id=1 and sequence_id=24
SELECT * FROM [db_xbr].[xbr_1_raw].[T_RI_TRANSACTION_TENDER]
WHERE store_id='PSH088' and business_date='2010-03-15 00:00:00.000'
and terminal_id=1 and sequence_id=24得到的数据是:和成一个sql语句我写的是:select distinct top 2 te.store_id,te.transaction_footertime,te.operator_name,ttn.transaction_type, tt.item_type,ttn.noun_type,ttn.stored_item,ttn.post_modify,ttn.quantity,ttn.item_description,ttn.unit_price,ttn.line_amount,tt.total_amount,tt.tender_amount,tt.change_amount,tt.tax_amount ,te.transaction_headertime
from xbr_1_raw.T_RI_EVENT te inner join xbr_1_raw.T_RI_TRANSACTION tt on te.business_date=tt.business_date
and te.terminal_id=tt.terminal_id and te.sequence_id=tt.sequence_id ,xbr_1_raw.T_RI_TRANSACTION ttn inner join
xbr_1_raw.T_RI_TRANSACTION_TENDER ttt
on ttn.business_date=ttt.business_date and ttn.terminal_id=ttt.terminal_id and ttn.sequence_id=ttt.sequence_id
where te.business_date='2010-03-15 00:00:00.000' and te.terminal_id=1 and te.sequence_id=24 and te.store_id='PSH088'我得到的是这样的:
我sql出上面问题了,求sql
----------------
transation_id 是T_RI_TRANSACTION主键么?
store_id:terminal_id 1:n?
两行其它都一样,只有item_type这列不同,一个是noun,另一个是condment请问这个item_type重要吗或者说要用到吗?如果可以的话,可以删除此列。
那结果就有一条 了