ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] SQL¦p¦ó¥ÎÀx¦s®æ°Ñ¼Æ(¤é´Á)§@±ø¥ó¨Ì¾Ú

[µo°Ý] SQL¦p¦ó¥ÎÀx¦s®æ°Ñ¼Æ(¤é´Á)§@±ø¥ó¨Ì¾Ú

SQL¦p¦ó¥ÎÀx¦s®æ°Ñ¼Æ(¤é´Á)§@±ø¥ó¨Ì¾Ú,·P®¦.

sql ¤é´Á1.rar (973.66 KB)

§ù¤p¥­

MySQL = "select *  from [sheet1$a1:f] where Format(¶}³æ¤é´Á,'ddddd') = '" & ms2 & "'"

TOP

¥»©«³Ì«á¥Ñ singo1232001 ©ó 2023-1-31 06:01 ½s¿è

¦^´_ 1# dou10801


    '¨D¬Y¤Ñ
'ms2 = Format([g1], "yyyy-mm-dd")
'MySQL = "select *  from [sheet1$a1:f] where Format(¶}³æ¤é´Á,'yyyy-MM-dd') = '" & ms2 & "'"  '¤j¤p¼g¦³®t

'¨D¬Y¤Ñ¨Ã¤é´Á®É¶¡»¼¼W±Æ§Ç
'ms2 = Format([g1], "yyyy-mm-dd")
'MySQL = "select *  from [sheet1$a1:f] where Format(¶}³æ¤é´Á,'yyyy-MM-dd') = '" & ms2 & "' " & " order by ¶}³æ¤é´Á asc"  '¤j¤p¼g¦³®t

'¨D·í¤Ñ¬Y®É¬q  2019/1/1  11:00~14:00
'ms31 = Format(#1/1/2019 11:00:00 AM#, "yyyy-mm-dd HH:nn:ss")
'ms32 = Format(#1/1/2019 2:00:00 PM#, "yyyy-mm-dd HH:nn:ss")
'MySQL = "select *  from [sheet1$a1:f] where Format(¶}³æ¤é´Á,'yyyy-MM-dd HH:nn:ss') between '" & ms31 & "' and'" & ms32 & "'"  '¤j¤p¼g¦³®t

'¨D³sÄò¤Ñ¼Æ 2019/1/1~2019/1/2
'ms41 = Format([g1], "yyyy-mm-dd")
'ms42 = Format([g1] + 1, "yyyy-mm-dd")
'MySQL = "select *  from [sheet1$a1:f] where Format(¶}³æ¤é´Á,'yyyy-MM-dd') between '" & ms41 & "' and'" & ms42 & "'"    '¤j¤p¼g¦³®t

'¨D¥ô´X­Ó¤Ñ¼Æ  2019  1/1 ,1/3, 1/5
'ms51 = Format(#1/1/2019#, "'yyyy-mm-dd'")
'ms52 = Format(#1/3/2019#, "'yyyy-mm-dd'")
'ms53 = Format(#1/5/2019#, "'yyyy-mm-dd'")
'MySQL = "select *  from [sheet1$a1:f] where Format(¶}³æ¤é´Á,'yyyy-MM-dd') in("            '¤j¤p¼g¦³®t
'MySQL = MySQL & ms51 & ","
'MySQL = MySQL & ms52 & ","
'MySQL = MySQL & ms53 & ")"

TOP

·PÁ lpk187¤Î singo1232001¨â¦ì«e½ú«ü¾É,¹ïªì¾ÇSQL»yªk¨ü¯q¨}¦h,§ó·P®¦singo1232001¥[½X«üÂI¹ï¨ä¥L¤é´Á¹B¥Î¬d¸ß§óÆF¬¡.
§ù¤p¥­

TOP

google"EXCEL°g"  blog  ©Îgoogleºô§}:https://hcm19522.blogspot.com/

TOP

¥»©«³Ì«á¥Ñ singo1232001 ©ó 2023-1-31 16:50 ½s¿è

¦^´_ 4# dou10801


©êºp §ó¥¿¤@¤U
Ãö©óvba ¤¤Format ¦³¦r¼Æ¤W­­ (¦ÓsqlªºFormat¨S¦³ )

©Ò¥H ms31 ¬d¸ß®É¶¡ªº¨Ò¤l¤¤
ms31 = Format(#1/1/2019 11:00:00 AM#, "yyyy-mm-dd HH:nn:ss")  '²£¥Xªº¤å¦r ¥i¯à·|Â_¦æ   ¬í¼Æ´N¥i¯à·|®ø¥¢

«Øij§ï¦¨©é¦rªº¤è¦¡
ms31 = Format(#1/1/2019 11:00:00 AM#, "yyyy-mm-dd   & " " & format(#1/1/2019 11:00:00 AM#, "HH:nn:ss")

©ÎªÌ
ms31 = Format([g1], "yyyy-mm-dd")   & " " & format(#11:00:00 AM#, "HH:nn:ss")

©ÎªÌ
ms31 = Format([g1], "yyyy-mm-dd")  & " " &  "11:00:00"

·íµM§A¤]¥i¥H¤@¦¸§â  '²Å¸¹µ¹«÷¥X¨Ó ¤§«á´N¤£¥Î¥[
ms31 = Format([g1], "'yyyy-mm-dd")  & " " &  "11:00:00'"

(¥t¥~¸É¥R  ¦bvba¤¤ ¯à¹BºâªºÀq»{¤é´Á®æ¦¡ ¬O2019/1/1    , ¦ÓSQL¤¤ ¯à¹BºâªºÀq»{®æ¦¡¬O2019-1-1  ) ©Ò¥H¦b¤å¦r¤¤­n°µÂà´«

TOP

¦^´_ 6# singo1232001


    ADODB¼gSQL»yªk¡A«÷±µªº¤è¦¡¡A³Ì®e©ö¥X¿ù¤F(¥H«áªº¾[ÃD¤]·|«Ü¦h)¡A«Øij¼gSQL®É³Ì¦n¨Ï¥Î°Ñ¼Æªº¤è¦¡¡A´N¨S¦³§A¤W­zªº°ÝÃD¤F¡I
Set cmd = CreateObject("ADODB.Command")
cmd.CommandText = "Select Max(Id) From [¶i³f$] Where ¶i³f¤é´Á=@¶i³f¤é´Á"
cmd.Prepared = True
cmd.Parameters.Append cmd.CreateParameter("@¶i³f¤é´Á", adDate, adParamInput, , [G1])
cmd.ActiveConnection = conn
Set rs = cmd.Execute

TOP

¦^´_ 7# lpk187 lpk187«e½ú,¬O§_¯à¨Ì¤W¤èÀÉ®×
sql ¤é´Á1.rar,§@¹ê»Ú¥Ü½d¾Ç²ß.·P®¦.
§ù¤p¥­

TOP

·PÁ¦U¦ì
¹ïSQL ªº ¤é´Á®æ¦¡Âà´«»Ý¨Dªº´£ÂI

TOP

        ÀR«ä¦Û¦b : ¤@¥y·Å·xªº¸Ü¡A´N¹³©¹§O¤H¨­¤WÅx­»¤ô¡A¦Û¤v·|ªg¨ì¨â¤Tºw¡C
ªð¦^¦Cªí ¤W¤@¥DÃD