mysql

MySQL datetime index is not working

Table structure: +-------------+----------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------------+----------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | total | int(11) | YES | | NULL | ...

Ruby Mysql troubles

I have troubles with mysql gem installation. I performed this in my terminal: (I am using Mac OS X Snow Leopard) sudo env ARCHFLAGS="-arch i386" gem install mysql -- \ --with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib \ --with-mysql-include=/usr/local/mysql/include Password: Building native extensions....

mySQL substring & instr problem

Anyone able to have at look at this? still un-resolved and am desperate to get this working, I am confident I know how the code is working, it is just a problem with the WHERE clause. I need it so that the var $pageGrandChild matches the last part of a string in the database i.e. foo-bar-rules. Any ideas? $pageGrandChild = PAGEGRANDCHI...

Delphi ADO + MySQL + Developer Express Grid

I have problems using Mysql with MySQL Connector, I can successfully connect to a database on the net via ODBC, and in my grid I can display many records, however in the grid (Developper express) I seem to be unable to scroll. i think it is related to cursor locations etc etc, but I am not sure. also recordcount and recno seems also not...

mysql connector problems

I have problems with MySQL Connector (MyConnector) it seem there is a problem when I modify my connection via ODBC, I can create new entries, but I am unable to edit them.. I found a patch for windows 7, 32Bit. but I also need a fix for Windows 7, 64bit. ...

Numbering MySQL Result Row

i have a mysql result set like bellow id name --------------------- 1 abc 1 abc 2 xyz 2 xyz 3 pqr now i need to modify the result set so that it would be like as follows: id name --------------------- 1 abc-1 1 abc-2 2 xyz-1 2 xyz-2 3 pqr ...

Detect if a date is in Daylight saving time in MySql

I have inherited a legacy application where all the dates and times are stored in the local timezone (UK). I am not in a position to change how these are stored. However, the requirement is to display all the dates in GMT within the app. Therefore when I retrieve a list of events from the database I need it to display them all in this ...

How to get all selected ids at once ? PHP/MySQL question

I have MySQL table called Files which has file_id column and file_type column (and also other columns that are not relevant to the question). I would like to get all file_ids of all picture files (i.e. file_type='picture'). I do the query like this: $pictures_query = mysql_query("SELECT file_id FROM Files WHERE file_type='picture') ...

Rewriting MySQL query with subqueries to joins.

I have written a fairly complex SQL query to get some statistics about animals from an animal sampling database. This query includes a number of subqueries and I would now like to see if it is possible to rewrite this query in any way to use joins instead of subqueries. I have a dim idea that this might reduce query time. (it's now about...

Drupal SQL "Select count distinct"

Hi can someone help debug this? Currently my script throws this error "Parse error: syntax error, unexpected '=' in includes/common.inc(1695) : eval()'d code on line 38" and I've narrowed it down to this SQL statement. It appears that counting results rows in Drupal isn't as straight forward as I'd hoped. $sql_checkIP = "SELECT COUNT(*...

Mysql group by help

Hello, after several attempts, I can not solve this problem. I have the following mysql query: SELECT date_format(connect_time,"%Y-%m-%d %H") AS date, NotConnected, count(id) as calls, sum(`duration`)/60 as minutes FROM test.`CDR_Vendors`, (SELECT ...

java.sql.SQLException: Column count doesn't match value count at row 1

Hi, I'm trying to update values using JDBC and I continue to get the same error for different tables and with different schemas. Let's say that I have a table like this +----------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------------+-------------+------+...

jQuery datepicker, disable dates from MYSQL

I have a list of dates stored in a MYSQL table, the idea is if the following field has valued 'completed' the row's date is unselectable in the jQueryUI datepicker. The dates are stored in the format YYYY-MM-DD.. how would I go about loading these 'completed' dates into a PHP array in a format for the datepicker to understand and disable...

Count changes of a value over time?

Hi all, again I am stuck with counting something in MySQL. The database structure is far from SOers´d call optimal, but nevertheless I do not have an influence here and have to live with it. Probably that´s one of the reasons why I need help again to get some information out of it :) Assume I have: some_id (not the PK of the table, n...

which is best, either fetching from another PHP file or from mysql db in PHP?

i have a module called online events in my website, this module will run for every 8 sec and fetches a recent activities in my websites. So, if more than 100 users are using my website at a time, it consumes more memory and more cpu usuage. what should i do to reduce cpu usage and memory, provided it should not affect a online events mod...

Make TIMESTAMP column update even though I didn't change anything?

I have a MySql table which has a timestamp column. The table also has alot of other columns. I have a "change classified" section on my page. When users change their classifieds, I want the timestamp to update its timestamp. And it does, but sometimes you don't change a classified at all, you just want it to be "renewed". How can I m...

Using MySQL Cast to find Wordpress posts with a custom field content equivalent to Price

I am using custom fields in Wordpress to contain an 'RRP' currency value. This field is text based, but I want to be able to run queries where I can bring out posts which have an RRP in a specific range. I've been looking into the MySQL CAST function and this seems to be the right thing, but I can't seem to get it working. Everything ...

FULLTEXT query with scores/ranks in Postgresql

Im new to Postgres and I dont know how to translate this MySQL query to postgres: SELECT pictures.id, MATCH (title, cached_tag_list) AGAINST ('phrase') AS score FROM pictures WHERE MATCH (title, cached_tag_list) AGAINST ('phrase') ORDER BY score DESC; ...

How to update using DataSet (C# and MySQL) with the database with no primary key

I am working on windows application using c# and MySQL. I inserted new record by reading text file into MySQL database, Database having no primary key but combination of four columns we can consider as component of primary key (but actually database having no primary key). I know how to add and update record using DataAdapter and DataSet...

Extracting information out of a column with regexs in MySQL

Hello, Is it possible to get the (first?) match of a regex and output it within a select? It looks like the REGEXP function only return whether there has been a match or not. I want to be able to extract information out of a varchar column without having to use complex SUBSTRING-LOCATION nestings. Any ideas? ...