Sub 项目状态查询()

'如果“项目状态”是未转运营那么实施状态是不能选择的,因为还没有实施。
'如果“项目状态”选择状态后,那么项目名称里面只显示该状态的项目名称。如果“项目状态”选择的不是未转运营,那么“实施状态”也要选择,并确定项目名称的选项。
'如果“统计值”是项目数,那么标题行就是客户角色。如果是实施时长,标题行就是实施的时间。
lst = Range("a1048576").End(xlUp).Row
If lst >= 4 Then
Range("a4:afd" & lst).ClearContents
End If

sAddress = ThisWorkbook.FullName

If Range("b1") = "未转运营" Or Range("b1") = "全部" Then
sAddress1 = Sheets("销售").Range("a3").CurrentRegion.Address(0, 0)

If Range("b1") = "全部" Then
temp1 = "辅助列"
Else
temp1 = "项目状态"
End If

If Range("d1") = "全部" Then
temp2 = "辅助列"
Else
temp2 = "城市维度"
End If

If Range("d2") = "全部" Then
temp3 = "辅助列"
Else
temp3 = "加盟类型"
End If

If Range("h2") = "全部" Then
temp4 = "辅助列"
Else
temp4 = "项目名称"
End If

Set cnn = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")
cnn.Open "Provider=microsoft.Ace.oledb.12.0;Extended Properties=Excel 12.0;Data Source=" & sAddress

strsql = "select * from [销售$" & sAddress1 & "] where " & temp1 & " = '" & Range("b1") & "' and " & temp2 & " = '" & Range("d1") & "' and " & temp3 & " = '" & Range("d2") & "' and " & temp4 & " = " & "'" & Range("h2") & "'"

strsql = "select " & Range("b3").Value & " , " & Range("b2").Value & " , count(*) as 统计 from (select * from [销售$" & sAddress1 & "] where " & temp1 & " = '" & Range("b1") & "' and " & temp2 & " = '" & Range("d1") & "' and " & temp3 & " = '" & Range("d2") & "' and " & temp4 & " = " & "'" & Range("h2") & "') group by " & Range("b3").Value & " , " & Range("b2").Value & ""

strsql = "transform count(*) select " & Range("b2").Value & " as 统计 from (select * from [销售$" & sAddress1 & "] where " & temp1 & " = '" & Range("b1") & "' and " & temp2 & " = '" & Range("d1") & "' and " & temp3 & " = '" & Range("d2") & "' and " & temp4 & " = " & "'" & Range("h2") & "') group by " & Range("b3").Value & " , " & Range("b2").Value & " pivot " & Range("b3").Value & ""

strsql = "transform count(*) select " & Range("b3").Value & " as 统计 from (select * from [销售$" & sAddress1 & "] where " & temp1 & " = '" & Range("b1") & "' and " & temp2 & " = '" & Range("d1") & "' and " & temp3 & " = '" & Range("d2") & "' and " & temp4 & " = " & "'" & Range("h2") & "') group by " & Range("b3").Value & " , " & Range("b2").Value & " pivot " & Range("b2").Value & ""

strsql = "transform count(*) select " & Range("b3").Value & " as 统计 from (select * from [销售$" & sAddress1 & "] where " & temp1 & " = '" & Range("b1") & "' and " & temp2 & " = '" & Range("d1") & "' and " & temp3 & " = '" & Range("d2") & "' and " & temp4 & " = " & "'" & Range("h2") & "') group by " & Range("b3").Value & " pivot " & Range("b2").Value & ""

strsql = "transform count(*) select " & Range("b2").Value & " as 统计 from (select * from [销售$" & sAddress1 & "] where " & temp1 & " = '" & Range("b1") & "' and " & temp2 & " = '" & Range("d1") & "' and " & temp3 & " = '" & Range("d2") & "' and " & temp4 & " = " & "'" & Range("h2") & "') group by " & Range("b2").Value & " pivot " & Range("b3").Value & ""

'sum(iif(isnull(项目名称),0,1))

rs.Open (strsql), cnn
Cells(5, 1).CopyFromRecordset cnn.Execute(strsql)

For Each Field In rs.Fields
aa = Field.Name
[a4].Offset(0, i) = Field.Name
i = i + 1
Next

Set rs = Nothing
Set cnn = Nothing
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

ElseIf Range("b1") = "销售转运营" And Range("h1") = "项目数" Then
sAddress1 = Sheets("实施").Range("a3").CurrentRegion.Address(0, 0)

If Range("d1") = "全部" Then
temp2 = "辅助列"
Else
temp2 = "城市维度"
End If

If Range("d2") = "全部" Then
temp3 = "辅助列"
Else
temp3 = "加盟类型"
End If

If Range("h2") = "全部" Then
temp4 = "辅助列"
Else
temp4 = "项目名称"
End If

If Range("f1") = "全部" Then
temp5 = "辅助列"
Else
temp5 = "实施进度"
End If

If Range("f2") = "全部" Then
temp6 = "辅助列"
Else
temp6 = "实施类型"
End If

Set cnn = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")
cnn.Open "Provider=microsoft.Ace.oledb.12.0;Extended Properties=Excel 12.0;Data Source=" & sAddress

strsql = "select * from [实施$" & sAddress1 & "] where " & temp2 & " = '" & Range("d1") & "' and " & temp3 & " = '" & Range("d2") & "' and " & temp4 & " = " & "'" & Range("h2") & "' and " & temp5 & " = '" & Range("f1") & "' and " & temp6 & " = " & "'" & Range("f2") & "'"

strsql = "select " & Range("b3").Value & " , " & Range("b2").Value & " , count(*) as 统计 from (select * from [实施$" & sAddress1 & "] where " & temp2 & " = '" & Range("d1") & "' and " & temp3 & " = '" & Range("d2") & "' and " & temp4 & " = " & "'" & Range("h2") & "' and " & temp5 & " = '" & Range("f1") & "' and " & temp6 & " = " & "'" & Range("f2") & "') group by " & Range("b3").Value & " , " & Range("b2").Value & ""

strsql = "transform count(*) select " & Range("b2").Value & " as 统计 from (select * from [实施$" & sAddress1 & "] where " & temp2 & " = '" & Range("d1") & "' and " & temp3 & " = '" & Range("d2") & "' and " & temp4 & " = " & "'" & Range("h2") & "' and " & temp5 & " = '" & Range("f1") & "' and " & temp6 & " = " & "'" & Range("f2") & "') group by " & Range("b3").Value & " , " & Range("b2").Value & " pivot " & Range("b3").Value & ""

strsql = "transform count(*) select " & Range("b3").Value & " as 统计 from (select * from [实施$" & sAddress1 & "] where " & temp2 & " = '" & Range("d1") & "' and " & temp3 & " = '" & Range("d2") & "' and " & temp4 & " = " & "'" & Range("h2") & "' and " & temp5 & " = '" & Range("f1") & "' and " & temp6 & " = " & "'" & Range("f2") & "') group by " & Range("b3").Value & " , " & Range("b2").Value & " pivot " & Range("b2").Value & ""

strsql = "transform count(*) select " & Range("b3").Value & " as 统计 from (select * from [实施$" & sAddress1 & "] where " & temp2 & " = '" & Range("d1") & "' and " & temp3 & " = '" & Range("d2") & "' and " & temp4 & " = " & "'" & Range("h2") & "' and " & temp5 & " = '" & Range("f1") & "' and " & temp6 & " = " & "'" & Range("f2") & "') group by " & Range("b3").Value & " pivot " & Range("b2").Value & ""

strsql = "transform count(*) select " & Range("b2").Value & " as 统计 from (select * from [实施$" & sAddress1 & "] where " & temp2 & " = '" & Range("d1") & "' and " & temp3 & " = '" & Range("d2") & "' and " & temp4 & " = " & "'" & Range("h2") & "' and " & temp5 & " = '" & Range("f1") & "' and " & temp6 & " = " & "'" & Range("f2") & "') group by " & Range("b2").Value & " pivot " & Range("b3").Value & ""

'sum(iif(isnull(项目名称),0,1))

rs.Open (strsql), cnn
Cells(5, 1).CopyFromRecordset cnn.Execute(strsql)

For Each Field In rs.Fields
aa = Field.Name
[a4].Offset(0, i) = Field.Name
i = i + 1
Next

Set rs = Nothing
Set cnn = Nothing

'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ElseIf Range("b1") = "销售转运营" And Range("h1") <> "项目数" Then
sAddress1 = Sheets("实施").Range("a3").CurrentRegion.Address(0, 0)
If Range("d1") = "全部" Then
temp2 = "辅助列"
Else
temp2 = "城市维度"
End If

If Range("d2") = "全部" Then
temp3 = "辅助列"
Else
temp3 = "加盟类型"
End If

If Range("f1") = "全部" Then
temp4 = "辅助列"
Else
temp4 = "实施进度"
End If

If Range("f2") = "全部" Then
temp5 = "辅助列"
Else
temp5 = "实施类型"
End If

If Range("h2") = "全部" Then
temp6 = "辅助列"
Else
temp6 = "项目名称"
End If

Set cnn = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")
cnn.Open "Provider=microsoft.Ace.oledb.12.0;Extended Properties=Excel 12.0;Data Source=" & sAddress

str1 = "select 销售转运营日期,周期维度,项目名称,城市维度,加盟类型,客户角色,仓库名,实施进度,项目阶段,阶段状态,实施类型,辅助列,月份维度," & _
" datediff('d',项目开始时间,项目结束时间) as 天数,运营经理人数 as 人数,运营经理成本 as 成本,'运营经理' as 岗位,'城市运营组' as 组名 from [实施$" & sAddress1 & "] " & _
" where " & temp2 & " = '" & Range("d1") & "' and " & temp3 & " = '" & Range("d2") & "' " & _
" and " & temp4 & " = " & "'" & Range("f1") & "' and " & temp5 & " = " & "'" & Range("f2") & "' " & _
" and " & temp6 & " = " & "'" & Range("h2") & "'"

str2 = "select 销售转运营日期,周期维度,项目名称,城市维度,加盟类型,客户角色,仓库名,实施进度,项目阶段,阶段状态,实施类型,辅助列,月份维度," & _
" datediff('d',仓调研开始日期,仓调研结束日期) as 天数,仓调研人数 as 人数,仓调研成本 as 成本,'仓调研' as 岗位,'仓运营组' as 组名 from [实施$" & sAddress1 & "] " & _
" where " & temp2 & " = '" & Range("d1") & "' and " & temp3 & " = '" & Range("d2") & "' " & _
" and " & temp4 & " = " & "'" & Range("f1") & "' and " & temp5 & " = " & "'" & Range("f2") & "' " & _
" and " & temp6 & " = " & "'" & Range("h2") & "'"

str3 = "select 销售转运营日期,周期维度,项目名称,城市维度,加盟类型,客户角色,仓库名,实施进度,项目阶段,阶段状态,实施类型,辅助列,月份维度," & _
" datediff('d',配调研开始日期,配调研结束日期) as 天数,配调研人数 as 人数,配调研成本 as 成本,'配调研' as 岗位,'配运营组' as 组名 from [实施$" & sAddress1 & "] " & _
" where " & temp2 & " = '" & Range("d1") & "' and " & temp3 & " = '" & Range("d2") & "' " & _
" and " & temp4 & " = " & "'" & Range("f1") & "' and " & temp5 & " = " & "'" & Range("f2") & "' " & _
" and " & temp6 & " = " & "'" & Range("h2") & "'"

str4 = "select 销售转运营日期,周期维度,项目名称,城市维度,加盟类型,客户角色,仓库名,实施进度,项目阶段,阶段状态,实施类型,辅助列,月份维度," & _
" datediff('d',仓库规划实施开始日期,仓库规划实施结束日期) as 天数,仓规划人数 as 人数,规划成本 as 成本,'仓规划' as 岗位,'仓库规划组' as 组名 from [实施$" & sAddress1 & "] " & _
" where " & temp2 & " = '" & Range("d1") & "' and " & temp3 & " = '" & Range("d2") & "' " & _
" and " & temp4 & " = " & "'" & Range("f1") & "' and " & temp5 & " = " & "'" & Range("f2") & "' " & _
" and " & temp6 & " = " & "'" & Range("h2") & "'"

str5 = "select 销售转运营日期,周期维度,项目名称,城市维度,加盟类型,客户角色,仓库名,实施进度,项目阶段,阶段状态,实施类型,辅助列,月份维度," & _
" datediff('d',实施筹备开始日期,系统上线日期) as 天数,实施人数 as 人数,实施人员成本 as 成本,'实施' as 岗位, '实施组' as 组名 from [实施$" & sAddress1 & "] " & _
" where " & temp2 & " = '" & Range("d1") & "' and " & temp3 & " = '" & Range("d2") & "' " & _
" and " & temp4 & " = " & "'" & Range("f1") & "' and " & temp5 & " = " & "'" & Range("f2") & "' " & _
" and " & temp6 & " = " & "'" & Range("h2") & "'"

str6 = "select 销售转运营日期,周期维度,项目名称,城市维度,加盟类型,客户角色,仓库名,实施进度,项目阶段,阶段状态,实施类型,辅助列,月份维度," & _
" datediff('d',B2B进件资料审核开始时间,商品B2B平台发布上架日期) as 天数,电商人数 as 人数,null as 成本,'电商客服' as 岗位,'客服组' as 组名 from [实施$" & sAddress1 & "] " & _
" where " & temp2 & " = '" & Range("d1") & "' and " & temp3 & " = '" & Range("d2") & "' " & _
" and " & temp4 & " = " & "'" & Range("f1") & "' and " & temp5 & " = " & "'" & Range("f2") & "' " & _
" and " & temp6 & " = " & "'" & Range("h2") & "'"

str7 = "select 销售转运营日期,周期维度,项目名称,城市维度,加盟类型,客户角色,仓库名,实施进度,项目阶段,阶段状态,实施类型,辅助列,月份维度," & _
" datediff('d',首次入仓日期,首次发货日期) as 天数,库房人数 as 人数,null as 成本,'库房' as 岗位,'仓库运营组' as 组名 from [实施$" & sAddress1 & "] " & _
" where " & temp2 & " = '" & Range("d1") & "' and " & temp3 & " = '" & Range("d2") & "' " & _
" and " & temp4 & " = " & "'" & Range("f1") & "' and " & temp5 & " = " & "'" & Range("f2") & "' " & _
" and " & temp6 & " = " & "'" & Range("h2") & "'"

str8 = "select 销售转运营日期,周期维度,项目名称,城市维度,加盟类型,客户角色,仓库名,实施进度,项目阶段,阶段状态,实施类型,辅助列,月份维度," & _
" datediff('d',驻场日期,离场日期) as 天数,驻场人数 as 人数,null as 成本,'驻场' as 岗位,'城市运营组' as 组名 from [实施$" & sAddress1 & "] " & _
" where " & temp2 & " = '" & Range("d1") & "' and " & temp3 & " = '" & Range("d2") & "' " & _
" and " & temp4 & " = " & "'" & Range("f1") & "' and " & temp5 & " = " & "'" & Range("f2") & "' " & _
" and " & temp6 & " = " & "'" & Range("h2") & "'"

strtotal = str1 & " union all " & str2 & " union all " & str3 & " union all " & str4 & " union all " & str5 & " union all " & str6 & " union all " & str7 & " union all " & str8

If Range("h1") = "实施人天(avg)" Then

strsql = "select " & Range("b3").Value & " , " & Range("b2").Value & " , avg(人数*天数) as 统计 from (" & strtotal & ") group by " & Range("b3").Value & " , " & Range("b2").Value & ""

strsql = "transform avg(人数*天数) select " & Range("b2").Value & " as 统计 from (" & strtotal & ") group by " & Range("b3").Value & " , " & Range("b2").Value & " pivot " & Range("b3").Value & ""

strsql = "transform avg(人数*天数) select " & Range("b3").Value & " as 统计 from (" & strtotal & ") group by " & Range("b3").Value & " , " & Range("b2").Value & " pivot " & Range("b2").Value & ""

strsql = "transform avg(人数*天数) select " & Range("b3").Value & " as 统计 from (" & strtotal & ") group by " & Range("b3").Value & " pivot " & Range("b2").Value & ""

strsql = "transform avg(人数*天数) select " & Range("b2").Value & " as 统计 from (" & strtotal & ") group by " & Range("b2").Value & " pivot " & Range("b3").Value & ""

ElseIf Range("h1") = "实施人天(sum)" Then

strsql = "select " & Range("b3").Value & " , " & Range("b2").Value & " , sum(人数*天数) as 统计 from (" & strtotal & ") group by " & Range("b3").Value & " , " & Range("b2").Value & ""

strsql = "transform sum(人数*天数) select " & Range("b2").Value & " as 统计 from (" & strtotal & ") group by " & Range("b3").Value & " , " & Range("b2").Value & " pivot " & Range("b3").Value & ""

strsql = "transform sum(人数*天数) select " & Range("b3").Value & " as 统计 from (" & strtotal & ") group by " & Range("b3").Value & " , " & Range("b2").Value & " pivot " & Range("b2").Value & ""

strsql = "transform sum(人数*天数) select " & Range("b3").Value & " as 统计 from (" & strtotal & ") group by " & Range("b3").Value & " pivot " & Range("b2").Value & ""

strsql = "transform sum(人数*天数) select " & Range("b2").Value & " as 统计 from (" & strtotal & ") group by " & Range("b2").Value & " pivot " & Range("b3").Value & ""

ElseIf Range("h1") = "成本(avg)" Then

strsql = "select " & Range("b3").Value & " , " & Range("b2").Value & " , avg(成本) as 统计 from (" & strtotal & ") group by " & Range("b3").Value & " , " & Range("b2").Value & ""

strsql = "transform avg(成本) select " & Range("b2").Value & " as 统计 from (" & strtotal & ") group by " & Range("b3").Value & " , " & Range("b2").Value & " pivot " & Range("b3").Value & ""

strsql = "transform avg(成本) select " & Range("b3").Value & " as 统计 from (" & strtotal & ") group by " & Range("b3").Value & " , " & Range("b2").Value & " pivot " & Range("b2").Value & ""

strsql = "transform avg(成本) select " & Range("b3").Value & " as 统计 from (" & strtotal & ") group by " & Range("b3").Value & " pivot " & Range("b2").Value & ""

strsql = "transform avg(成本) select " & Range("b2").Value & " as 统计 from (" & strtotal & ") group by " & Range("b2").Value & " pivot " & Range("b3").Value & ""

ElseIf Range("h1") = "成本(sum)" Then

strsql = "select " & Range("b3").Value & " , " & Range("b2").Value & " , sum(成本) as 统计 from (" & strtotal & ") group by " & Range("b3").Value & " , " & Range("b2").Value & ""

strsql = "transform sum(成本) select " & Range("b2").Value & " as 统计 from (" & strtotal & ") group by " & Range("b3").Value & " , " & Range("b2").Value & " pivot " & Range("b3").Value & ""

strsql = "transform sum(成本) select " & Range("b3").Value & " as 统计 from (" & strtotal & ") group by " & Range("b3").Value & " , " & Range("b2").Value & " pivot " & Range("b2").Value & ""

strsql = "transform sum(成本) select " & Range("b3").Value & " as 统计 from (" & strtotal & ") group by " & Range("b3").Value & " pivot " & Range("b2").Value & ""

strsql = "transform sum(成本) select " & Range("b2").Value & " as 统计 from (" & strtotal & ") group by " & Range("b2").Value & " pivot " & Range("b3").Value & ""

'ElseIf Range("h1") = "项目数" Then
'
'strsql = "select " & Range("b3").Value & " , " & Range("b2").Value & " , count(*) as 统计 from (" & strtotal & ") group by " & Range("b3").Value & " , " & Range("b2").Value & ""
'
'strsql = "transform count(*) select " & Range("b2").Value & " as 统计 from (" & strtotal & ") group by " & Range("b3").Value & " , " & Range("b2").Value & " pivot " & Range("b3").Value & ""
'
'strsql = "transform count(*) select " & Range("b3").Value & " as 统计 from (" & strtotal & ") group by " & Range("b3").Value & " , " & Range("b2").Value & " pivot " & Range("b2").Value & ""
'
'strsql = "transform count(*) select " & Range("b3").Value & " as 统计 from (" & strtotal & ") group by " & Range("b3").Value & " pivot " & Range("b2").Value & ""
'
'strsql = "transform count(*) select " & Range("b2").Value & " as 统计 from (" & strtotal & ") group by " & Range("b2").Value & " pivot " & Range("b3").Value & ""

End If

rs.Open (strsql), cnn
Cells(5, 1).CopyFromRecordset cnn.Execute(strsql)

For Each Field In rs.Fields
aa = Field.Name
[a4].Offset(0, i) = Field.Name
i = i + 1
Next

Set rs = Nothing
Set cnn = Nothing

Else

'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

End If

lst = Range("a1048576").End(xlUp).Row
If Range("b2") = "月份维度" Then

Range("A5:A" & lst).Select
Selection.NumberFormatLocal = "yyyy""-""m"
Range("A4:afd4").Select
Selection.AutoFilter
ActiveWorkbook.Worksheets("项目状态查询").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("项目状态查询").AutoFilter.Sort.SortFields.Add Key:=Range _
("A4"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortTextAsNumbers
With ActiveWorkbook.Worksheets("项目状态查询").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With

ElseIf Range("b2") = "周期维度" Then
'Selection.NumberFormatLocal = "0""周"""
Range("A5:A" & lst).Select
Selection.NumberFormatLocal = "0""周"""
Range("A4:afd4").Select
Selection.AutoFilter
ActiveWorkbook.Worksheets("项目状态查询").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("项目状态查询").AutoFilter.Sort.SortFields.Add Key:=Range _
("A4"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortTextAsNumbers
With ActiveWorkbook.Worksheets("项目状态查询").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With

End If

End Sub

VBA+SQL transform pivot union联合查询的基础应用的更多相关文章

  1. [办公自动化] 再读《让EXCEL飞》(从excel导入access数据时,union联合查询,数据源中没有包含可见的表格)

    一年多以前就买了@Mrexcel的<让excel飞>这本书.整体思路是利用access结合excel,大幅度提高数据分析效率. 最近又拿出来看了看.第十五章,比高级筛选更“高级”,P241 ...

  2. SQL server多表联合查询

    参考网址: https://blog.csdn.net/zou15093087438/article/details/79226394 1. 外连接可分为:左连接.右连接.完全外连接. a.  左连接 ...

  3. SqlSever基础 union 联合查询,厉害的并集 重复项只显示一个 两个查询结果并在一起后排序

    镇场诗:---大梦谁觉,水月中建博客.百千磨难,才知世事无常.---今持佛语,技术无量愿学.愿尽所学,铸一良心博客.------------------------------------------ ...

  4. SQL Server 使用union all查询多个条件数据合并分组显示,同比统计

    ),a.created_yearmonth,) created_yearmonth, a.countaccount countaccount, a.yxsl yxsl, a.sccdsl sccdsl ...

  5. laravel4.2 union联合,join关联分组查询最新记录时,查询条件不对,解决方案

    需求: 分组联合查询,或者最新记录. 问题:  mysql分组的时候默认会查询第一条记录,存在gourp by时 order by 无效. 一般解决办法就是 ,select * from ( sele ...

  6. SQL in优化将In转化为联合查询

    in查询有时候会非常影响性能,最好能转化为联合查询,但有的网友说sqlserver会自动将in转化为联合查询,但我实际遇到的有时候却不是这样.所以最好还是不要用in. 我自己的例子,用in的时候耗费了 ...

  7. SQL语句(六)分页查询和联合查询

    目录 一.分页查询 语法格式 应用 二.联合查询 语法和作用 特点 应用 UNION和UNION ALL的区别 一.分页查询 语法格式 SELECT 查询列表 FROM 表 WHERE ... GRO ...

  8. MySQL开发——【联合查询、多表连接、子查询】

    联合查询 所谓的联合查询就是将满足条件的结果进行拼接在同一张表中. 基本语法: select */字段 from 数据表1 union [all | distinct] select */字段 fro ...

  9. (五)连接查询(SQL99标准)、子查询、分页查询、联合查询

    一.连接查询(SQL99标准) 1.含义:当要查询的数据来自多张表时要使用连接查询 2.语法: select 查询列表 from 表1 别名 [连接类型] join 表2 别名 on 连接条件 [wh ...

随机推荐

  1. java虚拟机规范(se8)——java虚拟机结构(六)

    2.11 指令集简介 java虚拟机指令由一个字节的操作码,接着时0个或多个操作数组成,操作码描述了执行的操作,操作数提供了操作所需的参数或者数据.许多指令没有操作数只包含一个操作码. 如果忽略异常处 ...

  2. Oracle分区表之分区范围扫描(PARTITION RANGE ITERATOR)与位图范围扫描(BITMAP INDEX RANGE SCAN)

    一.前言: 一开始分区表和位图索引怎么会挂钩呢?可能现实就是这么的不期而遇:比如说一张表的字段是年月日—‘yyyy-mm-dd’,重复率高吧,适合建位图索引吧,而且这张表数据量也不小,也适合转换成分区 ...

  3. Python第十二节 异常

    Python 第十三节 异常 python的错误一般包含两类: 语法错误 : 语法错误一般就是, 当你写完程序提交的时候, 发现无法提交, 提示存在错误.例如: 英文逗号 错写成了 中文逗号 异常 : ...

  4. 记录ajax前后交互

    前台请求 $.ajax({ url : '/turn', type : "post", data : { "userName":userName, " ...

  5. Codeforces542E Playing on Graph 思维+DFS+BFS

    解法参考https://www.cnblogs.com/BearChild/p/7683114.html这位大佬的,这位大佬讲得很好了. 这道题还是有一定的思维的. 直接贴代码: #include&l ...

  6. vue中key的作用

    1.v-if中用key管理可复用的元素  Vue 会尽可能高效地渲染元素,通常会复用已有元素而不是从头开始渲染.这么做,除了使 Vue 变得非常快之外,还有一些有用的好处.例如,如果你允许用户在不同的 ...

  7. Tmux 简单配置使用

    Tmux Prefix (prefix) Tmux 使用 Prefix 以将自身的快捷键与其它应用区分,运行 Tmux 快捷键时首先按下这个 Prefix (默认是 Ctrl-b 组合键),松手后紧接 ...

  8. ES6(阮一峰) 数组的扩展

    1.扩展运算符 扩展运算符(spread)是三个点(...).它好比 rest 参数的逆运算,将一个数组转为用逗号分隔的参数序列. console.log(1, ...[2, 3, 4], 5) // ...

  9. c#开发应避免的几个小滥用

    一 String和StringBuilder              少量的字符串操作不宜采用StringBuilder.      由于string是不可变得对象,对于string的叠加,每次操作 ...

  10. 【代码工具】Orika JavaBean映射工具探秘

    转自:https://www.cnblogs.com/albert1024/articles/8434741.html Orika是一个简单.快速的JavaBean拷贝框架,Orika使用字节代码生成 ...