答案 0 :(得分:2)
如果它具有id属性,则应执行以下操作:
Sub FormatHyperlink()
' set up a sample document
Dim doc As Document
Set doc = Application.Documents.Add
Selection.TypeText "This is a hyperlink to the "
Selection.Collapse wdCollapseEnd
Selection.Hyperlinks.Add Selection.Range, _
"https://stackoverflow.com/", , , "greatest webpage"
Selection.TypeText " ever."
' retrieve the hyperlink
Dim lnk As Hyperlink
Set lnk = ActiveDocument.Hyperlinks(1)
' retrieve the field code of the hyperlink
Dim rng As Range
Set rng = lnk.Range.Duplicate
rng.TextRetrievalMode.IncludeFieldCodes = True
Dim fieldCodeLength As Integer
fieldCodeLength = Len(rng.Text)
rng.TextRetrievalMode.IncludeFieldCodes = False
' format the first word of the display text with a different color
rng.Start = rng.Start + fieldCodeLength + 1
rng.Collapse
rng.MoveEnd wdWord, 1
rng.Font.ColorIndex = wdRed
' format the rest of the hyperlink with another color
Set rng = lnk.Range.Duplicate
rng.Start = rng.Start + fieldCodeLength + 1
rng.MoveStart wdWord, 1
rng.Font.ColorIndex = wdDarkBlue ' or use rng.Font.TextColor = RGB(x,x,x)
End Sub
或者
SELECT * FROM Table
HAVING COUNT(shg_id) = 1 -- Record equal to 1
已更新 - 这在我身边很有效:
SELECT * FROM Table
HAVING COUNT(shg_id) = 2 -- Record equal to 2
另一个 - 稍微取自OTARIKI:
SELECT COUNT(shg_id) AS Total
FROM Table
WHERE shg_id= 4
GROUP BY shg_idHAVING COUNT(shg_id) = 1
答案 1 :(得分:2)
如果我正确理解,你需要这个:
select entered, count(*) from (
select shg_id, count(*) as entered
FROM mytable
group by shg_id
having count(*) between 1 and 2
)t
group by entered