I have this weird situation:
When I do on rails console Time.now or Time.zone.now I get the same values (suppose they run at the sime time: 2014-06-05 23:38:06 -0300)
But when I use Time.now in a query like: Match.where("datetime = ?", Time.now) it returns the time 3 hours ahead!
.to_sql output:
SELECT `matches`.* FROM `matches` WHERE (datetime = '2014-06-06 02:38:06')
any thoughts on that?
Rails 4
Mysql 5.5
Hello,
I want to upload dynamically content from a soccer live score website to my database.
I also want to do this daily, from a single page on that website (the soccer matches for that day).
If you can help me only with the connection and retrieval of data from that webpage, I will manage the rest.
website: http://soccerstand.com/
language: php/java - mysql
Thank you !
i'm just curious. so i ask this particular question about SQLite. I haven't use this type of database extensively. but care to explain what is the basic different between SQLite and Mysql ?
The reason behind all of this is i just want to know whether it possible to use it to store wordpress data and act as a database ?
Hi everyone,
I want to crate new table for each new user on the web site and I assume that there will be many users, I am sure that search performance will be good, but what is with maintenance??
It is MySQL which has no limit in number of tables.
Thanks a lot.
I am trying to number some rows on a bridge table with a single UPDATE/SELECT statement using a counter variable @row. For example:
UPDATE teamrank JOIN (SELECT @row := @row + 1 AS position, name FROM members)
USING(teamID, memberID) SET rank = position
Is something like this possible or do I need to create a cursor? If it helps, I am using MySQL 5.
When querying the database with:
@robots = Robot.all(:limit => 50, :offset => 0)
What is the best way to get the total number of rows without the :limit?
In raw MySQL you could do something like this:
SELECT SQL_CALC_FOUND_ROWS * FROM robots LIMIT 0, 50
SELECT FOUND_ROWS();
I am trying to parse the MySQL data types returned by "DESCRIBE [TABLE]".
It returns strings like:
int(11)
float
varchar(200)
int(11) unsigned
float(6,2)
I've tried to do the job using regular expressions but it's not working.
PHP CODE:
$string = "int(11) numeric";
$regex = '/(\w+)\s*(\w+)/';
var_dump( preg_split($regex, $string) );
How to find the nearest integer upon the provided one?
Say, I have the following integers in the mysql database: 405, 600, 304. The question is how to I select 600 upon providing 550 or select 304 upon providing 300 (ie, so as to find the nearest integer)?
i am talking about INTEGERS, not floats.
Does the MEMORY storage engine of MySQL ever write to disk the database contents?
Meaning, if I'm using the MEMORY storage engine and my database server loses power - do I lose all of my database content or is it backed up to disk?
I have a database in data center, which is running mySQL, and I want to change the database from data center to host in my company. At that time, I don't want to stop the data base in the data center, is there any ways / untities to this kind of integeration? Thank u..
I will be uploading my website to a VPS soon. It is a classifieds website which uses Solr integrated with MySql.
Solr is updated whenever a new classified is put or deleted.
I need a way to make the commit() and optimize() be automated, for example once every 3 hours or so.
How can I do this? (Details Please)
When is it ideal to optimize?
Thanks
Hi
I have checked these statements with mysql and no error will happen and also the out put will be 0 rows BUT my friend checked it and he found an error for SELECT becaouse it is out of range !! IS he correct? thanks
CREATE TABLE T1(A INTEGER NULL);
SELECT * FROM T1;
The following is my DB data, how can I sorting it by sid and prev_sid with php/mysql!?
sid prev_sid type
000 197 app_home
197 198 page_teach
198 218 page_teach
199 211 page_step
211 207 link
218 559 page_step
559 199 page_step
Result:
sid prev_sid type
000 197 app_home
197 198 page_teach
198 218 page_teach
218 559 page_step
559 199 page_step
199 211 page_step
211 207 link
000 197 198 218 559 199 199 211 207
What is the best SQL query to remove any text within parenthesis in a mySQL database? I'd like something that works regardless of the position of the parenthesis in the text (beginning, middle, end, whatever). I don't care about keeping the text inside the parenthesis, just removing it.
Thanks!
I'm using Mysql 5.1, and have this query, is there a way to not use the subqueries and accomplish the same result?
SELECT oref.affiliate_id, ROUND(sum( oph.amount ) * 0.10 ,2) AS tsum
FROM operators_referer AS oref
LEFT JOIN operators_payments_history AS oph
ON oref.operator_id = oph.operator_id
WHERE oref.affiliate_id = 28221
AND
(
oph.date_paid >
(
SELECT MAX(aph.date_paid)
FROM affiliates_payments_history AS aph
WHERE aph.operator_id = oref.affiliate_id
)
OR
(
SELECT MAX(aph.date_paid)
FROM affiliates_payments_history AS aph
WHERE aph.operator_id = oref.affiliate_id
)
is NULL
)
Hi,
I got used to the xml support and recursive common table expressions of sql server 2005. I am just wondering whether any free dbs like mysql support these requirements nowadays? Thanks.
Christian
hi guys, when i am using 'localhost' as the host for mysql database, sequel pro alert me that i will be using socket, if i am using '127.0.0.1', i am actually using the ip address and port 3306 to locate the server.
is there any difference?
hi how can i use more than one 'between' clause in mysql query ? like if i want to select students having height between 20 and 25 and weight between 50 and 70..
thanks in advance
tismon
Hi, when trying to create a simple procedure in mysql 5.1.47-community it fails everytime i've tried everything!
even simple things like this!
DELIMITER //
CREATE PROCEDURE two ()
begin
SELECT 1+1;
end;
//
Hey,
I'm doing a statistical research application. I need to store words according to 2 initial letters which is 676 combinations and each word has its number of occurrences (minimal, maximal, average) in text. I'm not sure how the model/schema should look like. There will be a lot of checking whether the keyword was already persisted. I appreciate your suggestions.
Edit: I'll be using either mysql or postgresql + spring templates
I have got a simple MySQL table and primary index (id) is not numbered one by one (1, 31, 35, 100 etc.). I want them to be numbered like (1, 2, 3, 4). Please tell me how to do it. I would also like to point that I am aware of possible consequences of the operation, but I just want to tidy up the table.
hi
my users upload photo and all uploads recorded in mysql with the date info. i want to limit uploads by the months. user may just upload 3 pics in a month. what is the best way to do this ?
cheers