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. 详解 Flexible Box 中的 flex 属性

    导读: 弹性盒子是 CSS3 的一种布局模式,一种当页面需要适应不同的屏幕大小以及设备类型时确保元素拥有适当的行为的布局方式.其中 flex 属性用于指定弹性子元素如何分配空间. flex 属性的值 ...

  2. Java面试宝典(2)Java基础部分

    31.String s = "Hello";s = s + " world!";这两行代码执行后,原始的String对象中的内容到底变了没有? 没有.因为Str ...

  3. shell变量的间接引用

  4. 爬虫(十二):图形验证码的识别、滑动验证码的识别(B站滑动验证码)

    1. 验证码识别 随着爬虫的发展,越来越多的网站开始采用各种各样的措施来反爬虫,其中一个措施便是使用验证码.随着技术的发展,验证码也越来越花里胡哨的了.最开始就是几个数字随机组成的图像验证码,后来加入 ...

  5. JavaScript常用技巧之字符串操作

    1.首字母大写 str.replace(/\b\w+/g, function (word) { return word.substring(0, 1).toLowerCase() + word.sub ...

  6. rabbitmq AmqpClient 使用Topic 交换机投递与接收消息,C++代码示例

    // strUri = "amqp://guest:guest@192.168.30.11:8820/test" // strUri = "amqp://[帐户名]:[密 ...

  7. JMeter 服务器监控插件环境配置

    1.工具准备: jmeter下载地址:(尽量下载老版本如apache-jmeter-2.11,其他的版本比较高,可能和jmeter-plugins不兼容) http://jmeter.apache.o ...

  8. PHP多参数方法的重构

    假设我们要完成一个保存文章的功能,如果采用函数编程的方式,大概会是下面这个样子: <?php function saveArticle($title, $content, $categoryId ...

  9. asp.net Mvc 增删改查

    1.创建项目 已经创建好项目了 2.创建数据库 使用这个数据库或者自己创建一个数据库,一个表就好,简单 USE [LearnAdminlte] GO /****** Object: Table [db ...

  10. cookie和session 的初步介绍

    Cookie和Session http协议不保存用户状态(信息) Cookie和Session都是为了能够保存用户信息 Cookie: 本质:保存在浏览器上的键值对 用途:标识当前用户信息 cooki ...