OutOfInk Posted March 25, 2014 Share Posted March 25, 2014 (edited) Am i better off using a join or between statement and if possible please leave an example. I want to retrieve the current 'round' from my database. To do this i need to compare the current date and time to the 'gameround' table 'Date' and 'Time'. This is an example of the database im trying to work which round it is; CellID Round Home HODDS Away AODDS Ground Date Time status won lost1 1 Collingwood 2.40 Fremantle 1.70 Etihad 2014-03-14 19:50:00 Lock None None2 1 GWS Giants 15 Sydney 1.00 Skoda 2014-03-15 16:40:00 Lock None None3 1 Gold Coast 2.50 Richmond 1.60 Metricon 2014-03-15 18:40:00 Lock None None Thanks Edited March 26, 2014 by mac_gyver removed hosting control panel links in example data Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted March 26, 2014 Share Posted March 26, 2014 (edited) when you copy/paste the content from your database gui, it copies the links and image tags leading to your web hosting, which causes a pop-up authentication dialog box every time someone views your post. in the future, just copy/paste the necessary text. Edited March 26, 2014 by mac_gyver Quote Link to comment Share on other sites More sharing options...
Solution mac_gyver Posted March 26, 2014 Solution Share Posted March 26, 2014 the following will select the current Round number, if any. if you want to select the rows corresponding to that round number, you would use this as a sub-query in your main query - SELECT Round, MIN(CONCAT(Date,' ',Time)) as start, MAX(CONCAT(Date,' ',Time)) as end FROM gameround GROUP BY Round HAVING NOW() BETWEEN start AND end Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.