我想知道如何以我只从客户那里获取数据的方式组织这些代码。我的问题是我从租房中得到重复的数据,这与我的需要相反。
SELECT DISTINCT C.CUSTOMER_ID , (C.FIRST_NAME|| ' ' || C.LAST_NAME) "Customer Name"
FROM CUSTOMER C
JOIN RENTAL R ON C.CUSTOMER_ID = R.CUSTOMER_ID
ORDER BY C.LAST_NAME;
我应该得到599行,这时我给了16044行。
答案 0 :(得分:1)
仅从租赁中获取不同的客户以加入客户。我认为您收到的错误 - Dim xl As New Excel.Application 'always use a variable to reference Excel, otherwise it may stay in memory, hidden.'
Dim b As Excel.Workbook = xl.Workbooks.Add 'do not use b = New Excel.Workbook, as this can cause a memory leak'
Dim s As Excel.Worksheet
xl.Visible = True
Dim sLast As Excel.Worksheet = b.Worksheets(b.Worksheets.Count)
b.Worksheets.Add(, sLast)
s = b.Worksheets(1) '1-based'
Dim o(199999, 1) As Object
For i As Integer = 0 To 199999
o(i, 0) = i.ToString
o(i, 1) = (200000 - i).ToString
Next i
s.Name = "ExcelDemo"
Dim r As Excel.Range = s.Range("A1", "B200000")
r.Value2 = o
s.Activate()
Dim strFilename As String = My.Computer.FileSystem.SpecialDirectories.Desktop & "\Junk" 'N.B. extension automatically added'
b.SaveAs(strFilename)
strFilename = b.FullName 'get full filename'
xl.Quit()
MsgBox(strFilename & " saved")
是因为使用了ORA-01791
。使用ORDER BY C.LAST_NAME
或ORDER BY "Customer Name"
ORDER BY 2
答案 1 :(得分:0)
你可以用
做到这一点OperationQueue