|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
||||
|
||||
|
finding dates that exist but not in a certain period
ok here is what i have. i have a log stored in a database, and i need to know how i can determine if an id has been inactive for for a certain time. how would i go about doing that? i tried selecting those that were active in the last period, but that doesn't exactly tell me who wasn't. so if someone has some code or an algorythm i'm all ears!
|
|
#2
|
|||
|
|||
|
Search for all dates outside of the define range.
|
|
#3
|
||||
|
||||
|
tried that but you could still have that id in the dates you didn't select, meaning that they were still active
|
|
#4
|
|||
|
|||
|
Are you looking for all ids that fall in a predefined time period?
|
|
#5
|
||||
|
||||
|
sorry, had a meeting. ok i need to see if an id hasn't shown up in the last 3 months based on the date period, so that i can display them, sortof an 'inactive account' way of presenting it.
|
|
#6
|
|||
|
|||
|
select id from table where activity + 90 days is less than today.
|
|
#7
|
||||
|
||||
|
so, how do i add 90 days (3 months) to each item in the database within my query?
|
|
#8
|
|||
|
|||
|
You could use the DATE_ADD(date,INTERVAL expr type) function.
http://www.mysql.com/doc/en/Date_an..._functions.html |
![]() |
| Viewing: Dev Shed Forums > Databases > Database Management > finding dates that exist but not in a certain period |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|