I need to use C++ and I'm not writing a web application.
> I have done queries to the database in PHP with variables like month but
> easily can select from a range of time and data to produce the same
> results, the output goes directly to the web so if that is what you are
> seeking for, I can help with PHP.
> Kandy Wong wrote:
>> I need to write a C++ program in a Linux environment to query with a
>> The user will only provide with an approximate time so I'd like to know
>> how can I write a program or a query to return the closest data.
>> The followings are the timestamp in the MySQL database:
>> | 2008-08-05 03:56:09 | 1217933769 |
>> | 2008-08-05 03:56:19 | 1217933779 |
>> | 2008-08-05 03:56:29 | 1217933789 |
>> | 2008-08-05 03:59:39 | 1217933979 |
>> | 2008-08-05 03:59:49 | 1217933989 |
>> | 2008-08-05 03:59:59 | 1217933999 |
>> | 2008-08-05 04:02:39 | 1217934159 |
>> | 2008-08-05 04:02:49 | 1217934169 |
>> | 2008-08-05 04:02:59 | 1217934179 |
>> For example, '2008-08-05 04:01:39' is the time provided by the user
>> does not exist in the database. So, how can I return the closest data?
>> know I can make use of 'LIKE' but this will return more than one data.
>> What is the best method to get the closest one?
>> And what is the good connector (C++ to MySQL) to use?
>> Any suggestion?
>> Thank you.
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: http://lists.mysql.com/mysql?unsub=1
Scientific Programmer Analyst
TRIUMF (Canada's National Laboratory for Particle and Nuclear Physics)
4004 Wesbrook Mall
Vancouver, BC, Canada, V6T 2A3
Phone: (604) 222- 1047 ext. 6193