看板 Database 關於我們 聯絡資訊
※ 引述《neocc (neo)》之銘言: : 請問各位 : 我有A,B兩個資料表 : 每個資料表 有id, colunm1,column2 : 如果我用recordset選取兩個資料表, recordset要轉印到excel : 以下 table C是想像的TABLE 最終我要用 : Sheets(1).Range("a1").CopyFromRecordset rst 來轉印到excel : ########我想要的選法 : id => table C id : A 的 column1 =>>> table C的 D1 : B 的 column1 =>>> table C的 D2 : A的column1-B的column2 =>>>>>>table C的D3 : 且ID要介於 10到100 : ########## : 請問這個rst.open SQL 寫法 要怎麼寫呢? : 我用的是access and excel : 謝謝各位~ 我的寫法是在SQL上RUN,Assess不曉得是否支援,您要試一下。 select row_number() over(order by A.id) as C_id, A.column1 as C_D1, B.column1 as C_D2, A.column1-B.column2 as C_D3 From A Inner Join B ON A.id=B.id Where A.id Between 10 And 100 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.136.224.65 ※ 編輯: rockchangnew 來自: 140.136.224.65 (09/11 19:51)
neocc:OK 謝謝~ 09/12 00:14