mysql

What is the best way to monitor a group of ebay users in my application?

I have a mysql database with a table of ebay users, and their individual auctions. What I wish to do is to be able to "monitor" certain users, which would basically include retriving all of the auctions of any monitored users. I would like to know the best way to do this. I am thinking of having another table, with just one column cont...

MySQL correlated subquery in JOIN syntax

I would like to provide a WHERE condition on an inner query by specifying innertable.id = outertable.id. However, MySQL (5.0.45) reports "Unknown column 'outertable.id' in 'where clause'". Is this type of query possible? The inner query is pivoting rows to columns using a GROUP BY. This could be entirely be performed in the outer query,...

Special order by on SQL query

I need to display a list of records from a database table ordered by some numeric column. The table looks like this: CREATE TABLE items ( position int NOT NULL, name varchar(100) NOT NULL, ); INSERT INTO items (position, name) VALUE (1, 'first'), (5, 'second'), (8, 'third'), (9, 'fourth'), (15, 'fifth'), (20, 'sixth'); Now, the o...

Data Loss in mySQL Using MEDIUMTEXT and pages

Somehow GROUP_CONCAT is able to round up six "pages" of an article (each stored as TEXT) and toss them into a single MEDIUMTEXT without losing any data, but there are some one-page articles that are longer than normal (but still obviously fit within the TEXT data type) that lose a significant amount of data. Anyone know what's up? Origi...

jQuery forms.js with multiple forms per page

I would like to submit information to a mySql database using php and ajax. The page that the info is being sent from (form.php) has multiple forms that are generated from a "while()" loop. On success, I would a response to update a div above the particular form from which the data was submitted. I am currently using jQuery and the jqu...

[PHP] ORM Query results: Arrays vs Result handle wrapped in Iterator interface

Okay, here's one for the pro's: For a couple of years now, i've been working on my own PHP ORM/ActiveRecord implementation that i named Pork.dbObject. It's loosly based on the 'make your own site with rails in 5 minutes' movie we all saw a couple of years ago. You can do things like: $clients = dbObject::Search("Client", array("ID > 5...

mysql multi-column search

I have a table like this: +-------------------+---------------+ | description | colour | +-------------------+---------------+ | Macrame Dress | Washed Black | | Darcelle Gilet | Dirty Shellac | | Darcelle Cardigan | Washed Black | | Let It Rot Vest | Optic White | | Let It Rot Crew | Washed Black | | Let It...

SQL - Select rows from two different tables

Having this table Table "Items" itemID itemTitle itemContent and this Table "MyList" userID itemID deleted how can I select all rows from table "Items" and showing the field "deleted", even if the itemID do not exist in "MyList", given an userID? Example of the query result: itemID | itemTitle | deleted | userID ---------------...

How to perform grouped ranking in MySQL

So I have a table as follows: ID_STUDENT ID_CLASS GRADE 1 1 90 1 2 80 2 1 99 3 1 80 4 1 70 5 2 78 6 2 90 6 3 50 7 3 90 I need to then group, sort and order them to give: ID_STUDENT ID_CLASS GRADE RANK 2 1 99 1 1 1 90 2 3 1 80 3 4 1 70 4 6 2 90 1 1 2 80 2 5 2 78 3 7 3 90 1 6 3 50 2 Now I know that you can use a temp variable to rank...

finder_sql for has_many relation

Given the following two (simplified) models: class Customer < ActiveRecord::Base # finder sql to include global users in the association has_many :users, :dependent => :destroy, :finder_sql => 'SELECT `u`.* FROM `users` `u` WHERE (`u`.`customer_id` = "#{id}" OR `u`.`customer_id` IS NULL)' validates_presence_of :name end clas...

handling timestamps with PHP and MySQL(have I got my theory right?)

Hi I've been researching timestamps in PHP & MySQL. My undertanding is that UNIX timestamps only exist in GMT ... the whole point being that you convert it into the users timezone (GMT +/- timezone = users localtime). I'm doing this successfuly by saving the timestamp in it's "raw" form (as a 10 digit long int) and converting it into l...

Optmizing MySQL GROUP BY or DISTINCT on large views

Consider a view consisting of several tables... for example a v_active_car, which is made up of the tables car joined on to body, engine, wheels and stereo. It might look something like this: v_active_cars view SELECT * FROM car INNER JOIN body ON car.body = body.body_id INNER JOIN engine ON car.engine = engine.engine_id I...

Synchronizing SQL Server 2005 with MySQL

I'm need to copy several tables wholesale from a third-party SQL Server 2000 database to a MySQL 5 database and keep them synchronized--i.e., when some CRUD happens on the SQL Server tables, I'd like it to be reflected in the MySQL versions in a timely manner. Now, I know there are ways to do this with 2000, but some time in the near fut...

What is the best database to use for an intranet?

Someone suggest me to use a wamp for the intranet but the database is already setup with a mssql. I want to know if it's a great move to use mysql instead of mssql cause I have to migrate all data from mssql to mysql. Plus, I want to know some crappy problem that I can face during the migration. Thanks! ...

Dealing with dates

So basically I am storing a bunch of calendar events in a mysql table. And I store the day of the week they are supposed to happen, as well as the time. Right now the time is stored as the number of seconds from midnight calculated in GMT. But when I have people log on and check the calendar and they are from a different timezone othe...

Low Cost Online SQL or mySQL training?

Hi, I'm a Lotus Domino programmer who is in between consulting jobs - not by choice the consulting job market really sucks right now. With some extra time on my hands I would like to receive some SQL training as a resume booster and to expand my skill set. SQL is something I have used in the past, but I need a way to document my knowl...

When *not* to use prepared statements?

I'm re-engineering a PHP-driven web site which uses a minimal database. The original version used "pseudo-prepared-statements" (PHP functions which did quoting and parameter replacement) to prevent injection attacks and to separate database logic from page logic. It seemed natural to replace these ad-hoc functions with an object which u...

mysql master/slave failover

Is there any product that make mysql master/slave failover process easier? something that can happen automatically, rather than manually fix it. ...

Outputting data a row at a time from mysql using sqlalchemy

I want to fetch data from a mysql database using sqlalchemy and use the data in a different class.. Basically I fetch a row at a time, use the data, fetch another row, use the data and so on.. I am running into some problem doing this.. Basically, how do I output data a row at a time from mysql data?.. I have looked into all tutorials ...

Performance tool for MySQL and Oracle?

I'm looking for a performance tool for testing of load in terms of data and number of users. This tool must support Oracle and MySQL. PS: I've tried DBtuna and Spotlight. ...