SQL - Select using current day…
August 23rd, 2007 by Brian M McGarvie
I’ve had this problem a few times, and many people always ask me it… so here it is immortalised.
If you require to select all records added to your table for the current day use the following where clause - obviously ‘col’ should be the name of your datetime column…
Hope this helps you all as much as it has myself!
select *
from mytable
where datediff(day,getdate(),col)=0 and col <= getdate()
Posted in Programming, SQL
November 21st, 2007 at 9:43 pm
Private Sub lm_Click()
s1 = “select prof.nom_prof from ((((classe inner join r_pc on classe.code_classe=r_pc.code_classe) “
s2 = “inner join prof on r_pc.code_prof=prof.cde_prof) “
s3 = “inner join r_pm on prof.cde_prof=r_pm.code_prof)”
s4 = ” inner join module on r_pm.code_module=module.code_mod )”
s5 = ” where module.lib_mod=’” + lm + “‘”
r_sql = s1 & s2 & s3 & s4 & s5
Set tabl = bd.OpenRecordset(”select prof.nom_prof from ((((classe inner join r_pc on classe.code_classe=r_pc.code_classe) inner join prof on r_pc.code_prof=prof.cde_prof)inner join r_pm on prof.cde_prof=r_pm.code_prof)inner join module on r_pm.code_module=module.code_mod )where module.lib_mod=’” + lm + “‘”)
While Not tabl.EOF
lp.AddItem tabl![nom_prof]
tabl.MoveNext
Wend