mysql

How to construct the query

I am confused with building the query. I am implementing the search feature in a restaurant site. User first selects the area he is searching for restaurant and then he select the food types like chinese, japanese, thai from the checkboxes. After selecting all these, the restaurants which providing the selected food in the selected area...

How to optimize an ORDER BY for a computed column on a MASSIVE MySQL table

I have a very large (80+ million row) de-normalized MySQL table. A simplified schema looks like: +-----------+-------------+--------------+--------------+ | ID | PARAM1 | PARAM2 | PARAM3 | +-----------+-------------+--------------+--------------+ | 1 | .04 | .87 | .78 | +-------...

Select & Insert across multiple databases with MySQL

I have 2 identical tables in 2 different databases that reside on the same server. What would be the best way to copy data from table to another? ...

Live video streaming like ustream.com?

I have a customer that is currently using ustream.com as his live video streaming service. Basically he has a site for local sports where they stream the games. The problem is, ustream does not keep a copy of the videos for archiving for watching later. Basically I'm looking for a php/mysql compatible solution for having him handle the ...

PHP, text echos out of database without new line, all in one piece.

Hi guys, I have a longtext in a database. It looks fine from php_mayadmin, but when I echo it out to a page, it loose all formatting, i.e. no new lines, all in one chunk. Any ideas? :) Thanks! ...

MySQL Sum based on date range and time of day

Hello, I have a large set of data collected every 15 minutes. I am trying to select data between a certain time period and then within that time period divide it up by another date intervals. And within those intervals sum over a certain time period. For example, I would like to be able to select data between 01/01/2009 and 01/01/2...

Select rows whose IDs are not found in another table under certain constraints

The practical problem I'm solving is to display a list of items that have been updated recently that the user has not viewed recently. I'm trying to return a table containing items that are not containing in an item views table for a given user (let's say for this case user number 1). I've come up with: SELECT * FROM items i WHERE i.up...

MySQL: Possible to have wildcards in AS aliases?

I have a bunch of fields named the same across multiple tables (I inherited it - don't blame me ;). Instead of setting up all of the aliases verbosely, is it possible to assign/prepend an alias automatically by way of a wildcard? I'm envisioning something like (which of course doesn't really work): SELECT t1.*,t2.* as alias2.*, t3.* ...

mysql dump issue...

mysql gives me the syntax error with the following line... i dont know what is wrong with this... mysqldump -u root -p root mydatabase > dumpfile.sql i am using windows vista... plz help here.. thnx.. ...

How to get order output after using group in the sql query?

Hi, I have a my sql table with customer names and orders that they placed over time. table column names are id, customer name, order value, status, and created and modified. I am able to group customer names and number of orders. using a sql query like this.. SELECT Customer,count(OrderPrice) FROM Orders GROUP BY Customer It work...

DBLinq for a production system?

We're working on an ASP.NET web application with C# code behind. The database is MySQL 5.1 using InnoDB. The data access layer uses ADO.NET to call stored procedures and then builds various data structures out of the result sets (no object mapping). This works fine, but it is a little verbose. Not surprisingly, we made some mistakes ...

Indexing and searching MySQL with solr

(I have put ' in the XML below to make it display) Hi all I want to index my MySQL db table with solr. I have installed the necessary java components/adaptors etc. My database is called 'test_db' and the table in it is called 'table_tb'. The table contains 2 columns (fields) -Field 1 is called 'ID' and is an autoincremented primary ke...

Mysql::Error: Incorrect string value: '\xE9ditos...' with rails.

I am inserting data from CSV to database. While i am trying to insert this row 2 créditos,,,,R,75,, into my database i am getting this error Mysql::Error: Incorrect string value: '\xE9ditos...' for column 'message' at row 1: . ...

Access and Change PHP MySQL Fields Easier

I have a PHP web application where users, when logged in, have a bunch of different properties associated with them in a MySQL table. I'd like an easy way to access and change (get/set) those properties. What I want to do is something like this: $obj = mysql_fetch_object(mysql_query("SELECT * FROM users WHERE userid = '$id'")); So the...

Fun with sessions

I've a problem that annoy me very much. It's because I'm trying to make a PHP login script. But when I log in correctly, it'll not let me in. If I comment out some lines (I'll mark them), the script works, but that's the code I was planning to use to check in on every page, so people don't can come in if they don't should have access. ...

Link in foreign keys in phpmyadmin

I have foreign keys set in a mysql db. I have backed up my db from one server to a new one. Both the new and the old server use phpmyadmin. On the old server, y used to have a link in the view of a table from the foreign key to the respective register in the other table. An html link that leads me to the register in the other table. But ...

Mysql performance with nested indices

I have a mysql table (articles) with a nested index (blog_id, published), and performs poorly. I see a lot of these in my slow query logs: - Query_time: 23.184007 Lock_time: 0.000063 Rows_sent: 380 Rows_examined: 6341 SELECT id from articles WHERE category_id = 11 AND blog_id IN (13,14,15,16,17,18,19,20,21,22,23,24,26,27,6330,6331,...

PHP/MYSQL Help - unexpected T_VARIABLE

Hi All, I am trying to make a edit profile page and i want the user to be able to change there username and email address. I've been going at this problem now for sometime and need your help. Parse error: syntax error, unexpected T_VARIABLE $edit = mysql_query("UPDATE users (Username, EmailAddress) VALUES('".$newusername."', '".$ne...

How do I search "many LIKE" in the database (mysql)?

I want to search number of strings in the Database (type: MYSQL) and I did this: SELECT * FROM `rooms` WHERE `dates` LIKE '%09/08/10%' OR '%08/08/10%' Why doesnt it work? when I removed the part of OR '%08/08/10%' it was working well, I think I use it not good. How should I do it? ...

Copy data from 1 DB to another DB

I have to delete some table data in prod. db and for the records that are going to be deleted a backup of records should be copied to another local db. This involves two databases, residing in two different servers/instances. Is it possible to do via sql (mysql) query to do this? ...