mysql

What's wrong with this Query?

What's wrong with the following SQL query? $sql="SELECT * FROM ".TABLE." WHERE desgid='$id', weightid='$weightid' AND deptid='$deptid' "; The error message is: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' weightid='12' AND deptid='31...

Restrict SQL results by time, MySQL

Hey, I have a table containing events which happen in my application like people logging in and people changing settings. They have a date/time against the event in the following format: 2010-01-29 10:27:29 Is it possible to use SQL to select the events that have only happened in the last 5 mins? So if the date/time was 2010-01-29 ...

How to implement mysql compress() function in php

I want to compress TEXT for storing in MySQL. So I would just do gzcompress() in php and then send to mysql, but I am also setting up Sphinx full text search, and it would be nice if it can populate its index with a simple query i.e. select uncompress(thing) from table However I would still like to do compression and decompression for...

Is there any difference between DATE_SUB() and using arithmetic operators for datetime calculation?

After I have seen a lot of questions here using the DATE_SUB() or DATE_ADD() functions instead of the arithmetic operators + or -, I was wondering if there was any difference: Quote from the MySQL-manual: Date arithmetic also can be performed using INTERVAL together with the + or - operator: date + INTERVAL expr unit date - INTER...

Mysql PHP Script to slow needs refactor

Hi I have 2 mysql tables and they both need updating, companies unique_code Companies holds 1 million records and I need a unique code asigning to each one, the problem I have is my PHP script grabs all the companies and in foreach loop grabs a unique code from table unique_code and updates, it also then updates unique_code table to ...

Error in the query

$sql="SELECT users.*,designation.designation FROM `users` LEFT JOIN designation ON users.desgid=designation.id WHERE deptid='$deptid'" I get deptid is ambigous when i execute the query. ...

MySql Turkish Character Problem

Hi all, I'm writing a program. This program transfer Datas to MySql Database Which is in SQL Server Datas. MySql Database Default CharSet is Latin1. Usually Latin5 charset is using for Turkish characters. Bu ı cant change the mySql table's CharSet. Because its very old a database. Is any way to Import Turkish chars to mySql database corr...

MySQL Spatial search for HSV (color) values?

Is it possible to use MySQL's spacial search to find points inside of a 3D polygon? Or better still, is it possible to use MySQL to find the values on the surface of an HSV cylinder? ...

Client ajax updates from the server without repeating code every second?

I would like to check a database for a change using ajax. However, I do not want to overload the server by constantly checking it every second. Is there any other way of updating the clients from the server? Can jquery listen for event server side? Thanks ...

populate multi-dimensional arrays.

hello, im just working on integrating a script into my own site and this script (being that is has a chat feature) has inbuilt smilies, my site also has smilies but the url of them is stored in the sites mysql db, pulling said files from the db into the script im integrating is easy, but the script uses a 2 dimensional array for the smil...

Ajax Pagination with Jquery, PHP, Mysql

Hello all, I am looking for a good ajax pagination tutorial that uses jQuery, PHP, and MySQL. The ones that I have come across are not good. So, if anyone could recommend a good site/tutorial that would be great. thanks. Edit Here are some tutorials that were not good. Site 1 Site 2 Site 3 ...

Symfony Propel Pager - what is the proper way to send it a custom MySQL query?

Here is the query I need to run SELECT REPLACE(REPLACE(SUBSTRING_INDEX(LOWER(table.url), '/', 3), 'www.', ''), 'http://', '') AS domain FROM table GROUP BY domain But I'm having trouble passing a query like this to the Propel pager as criteria. I was hoping this would work. $criteria->addSelectColumn('SUBSTRING_INDEX(' . Table...

mysql query help - complicated join/order by scenario

Hi, I need to write a query and I'm not even sure where to begin on this one. I have a set of tables that I did not create and cannot change. member table +----+-------+ | id | class | +----+-------+ | 1 | 1 | | 2 | 2 | +----+-------+ member_data table +----+------------+-----------+ | id | first_name | last_name | +----+----...

Is it possible to speed up a sum() in MySQL?

I'm doing a "select sum(foo) from bar" query on a MySQL database that's summing up 7.3mm records and taking about 22 seconds per run. Is there a trick to speeding up sums in MySQL? ...

Need help with small Solr problem

I have a String field where I store two-word area names. Ex: New York Thing is, whenever I try to query that field (area:New York) no results come up, even though it is stored exactly as New York. Why is this? The results DO come up if I search like this: area:"New York" but they wont come up if searching like this: area:New. Any id...

Sum values of a single row?

I have a MySQL query that returns a single row that is a series of 1s and 0s. It's for a progress bar indicator. I have the summing of it in code now, but I tried to sum the values in a query, and realized I couldn't use SUM(), because they're many columns but just one row. Is there a way I can sum this automatically in the query? It's...

Online MySQL database in Objective-C

I'm writing a game for iPhone, and I want an online leaderboard using mySQL, which i'm very familiar with. How do I implement this in my app? I would assume there's a framework/library i need to obtain? ...

python log view application

I want to have GUI application or Web app where I can view the python log information. I can choose any formatter required. But it should work with standard logging module. I have configured my logs to file. But I wanted to have log to be stored to mysql db (it is possible) but I badly need user interface to view the log from remote pl...

Please help on a complicated sql query

MySQL 5.0.45 Table A has the following fields (columns): 1. transcation_id 2. client_name 3. item_id 4. ..... Now I need to find how many transactions each client has made order by # of transactions. The result should be like: Tom 7 transactions Jack 5 transactions Mike 2 transactions If a client has no transactions his n...

album tree deletion

i have following table album_id | sub_album_id | name sdf2342 | 0 | family a2243d | sdf2342 | wife 23ods | sdf2342 | jack 23jskd | 0 | places i want to delete selected album with its all the sub_album and if there is more sub_album then de...