If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > How do i select current program from this table

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-15-11, 22:16
linux1880 linux1880 is offline
Registered User
 
Join Date: Jul 2010
Posts: 39
How do i select current program from this table

I am trying to select current program (which is happening now) from this table. Please help Thanks.

Code:
CREATE TABLE `programs` (
 `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
 `p_day` varchar(20) NOT NULL,
 `program` varchar(255) NOT NULL,
 `p_start` time NOT NULL DEFAULT '00:00:00',
 `p_end` time NOT NULL DEFAULT '00:00:00',
 PRIMARY KEY (`id`)
)
Reply With Quote
  #2 (permalink)  
Old 08-15-11, 23:23
Pat Phelan Pat Phelan is offline
Resident Curmudgeon
 
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,606
What determines the "current-ness" for your purposes?

-PatP
__________________
In theory, theory and practice are identical. In practice, theory and practice are unrelated.
Reply With Quote
  #3 (permalink)  
Old 08-16-11, 05:24
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
Code:
SELECT p_p.id 
     , p_p.p_day 
     , p_p.program 
     , p_p.p_start 
     , p_p.p_end 
  FROM programs AS p_p 
 WHERE p_p.p_day = DATE_FORMAT(CURRENT_DATE,'%W)
   AND CURRENT_TIME BETWEEN p_p.p_start AND p_p.p_end
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Tags
mysql

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On