corillo181 Posted August 20, 2008 Share Posted August 20, 2008 hi! i have a section where ppl can vote for stuff. i want to know how can i make a query selection that select between the votes that happen Monday threw Sunday of the week before. like if today is Monday - threw Sunday i want the votes that happen Monday threw Sunday of last week. can this be done? any help will be appreciated i know if i can get a theory or even a starting point i can make the code. thanks for any help. Link to comment https://forums.phpfreaks.com/topic/120553-solved-query-selection/ Share on other sites More sharing options...
ninedoors Posted August 20, 2008 Share Posted August 20, 2008 So are you looking for a query that will pull the votes for ($today -7) thru to ($today -1)? Link to comment https://forums.phpfreaks.com/topic/120553-solved-query-selection/#findComment-621234 Share on other sites More sharing options...
corillo181 Posted August 20, 2008 Author Share Posted August 20, 2008 nope 7 days from today is not last week total dates. something like this but is not working. SELECT * FROM `clicks` WHERE DATE_SUB(`date`, INTERVAL 1 WEEK) Link to comment https://forums.phpfreaks.com/topic/120553-solved-query-selection/#findComment-621248 Share on other sites More sharing options...
ninedoors Posted August 20, 2008 Share Posted August 20, 2008 Sorry, not sure then. Link to comment https://forums.phpfreaks.com/topic/120553-solved-query-selection/#findComment-621260 Share on other sites More sharing options...
corillo181 Posted August 20, 2008 Author Share Posted August 20, 2008 no worries i got it, just needed to know a couple of functions in mysql. jus tin case any one seach for the same question the answer is this SELECT * FROM `song_clicks` WHERE YEARWEEK( `date` , 1 ) = YEARWEEK( DATE_SUB( CURRENT_DATE, INTERVAL 1 WEEK ) , 1 ) ORDER BY `date` DESC ; seach for YEARWEEK and DATE_SUB,DATE_ADD Link to comment https://forums.phpfreaks.com/topic/120553-solved-query-selection/#findComment-621283 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.