mysql

whats the advantage or disadvantage of doing one of these way

I see some people do joins like this SELECT * FROM table1 JOIN table 2 ON table1_id = table2_id where as some people do this SELECT * FROM table1 WHERE table1.table1_id = tabl2.table2_id; whats the difference and what is more efficient and benificial ...

datatype to store a delimited list

I want to store strings like this "1,5,6,7,9,45,20,45,78,81..." Numbers can't be negative or decimal and vary form 0-+-200 Numbers are separated by ',' List can be 0-150 items long max. What Datatype should I use for the column that will hold these strings? ...

Programmers or Framework

Without going into the specifics if our dev team is use to programming in pure PHP/MySQL but after 6 months of working with a framework they are still taking twice as long to do things in the framework is it them or the framework? I am inclined to think the members of the dev team are lacking in skills as their work in pure PHP/MySQL ...

ORDER BY in PHP/MYSQL not working

The sql query is $query = mysql_query( "SELECT * FROM games ORDER BY gamename" ); But it doesn't order them by the gamename. This is a sample of the database id (int) | gamename (text) | gameurl (varchar) | width (int) | height (int) 1--------- Copter ---------- copter ----------- 100 ---------- 200-------- 2--------- Adrenaline -...

migrating a stored procedure from mysql 5.0 to 5.1.37

Hi, I am trying to migrate my database from MYSQL 5.1.37 on my machine to MYSQL 5.0 on my hosting company. But the problem is, while I am able to migrate my tables I got errors when I try stored procedures. Here is one which works fine on my machine. DELIMITER $$ DROP PROCEDURE IF EXISTS `db986`.`sp_addUser`$$ CREATE DEFINER=`tse`@`%...

Paginating with Coldfusion

Is it possible to paginate and display number of pages in Coldfusion using only one query? My understanding is you can obviously paginate with one query, but you would need an additional query to create the pages. This is in order to calculate the total number of results. (currentPage - 1) * resultsPerPage = Offset in MySQL query. This...

php and mysql, best practices

I started working with php and mysql today. Basically, what I have, is an empty page with pieces that I fill in from looking up an id in a database. So on my home page I have an url that looks like this: <a href="content/display.php?id=id1"> And then in my display.php I have this: <?php include '../includes/header.php'; $i...

How does database tiering work?

The only good reference that I can find on the internet is this whitepaper, which explains what database tiering is, but not how it works: The concept behind database tiering is the seamless co-existence of multiple (legacy and new) database technologies to best solve a business problem. But, how does it implemented? How does...

MySQL conditional query

I have a situation where I've got file names stored in two fields in a table. The fields are called file1 an file2. file1 is ALWAYS present. file2 might not be present for some rows. I want to write a query that would get me only a certain extension of files from the DB. For that I am using for example ...WHERE file1 LIKE '%jpg%' ...

DELETING any record in any table in the database if feildx=123

is there a mysql statemnet that goes through every table in a data base and says if applicationid =123 or schoolid=123 or familyid = 123 DELETE THE WHOLE record? i need to write a php script that will do this. ...

Finding special characters in MySQL database

Does anyone know of a quick and easy way to locate special characters that didn't get correctly converted when data was imported into MySQL. I think this an issue due to data encoding (e.g. Latin-1 vs. UTF-8). Regardless where the issue first occurred, I'm stuck with junk in my data that I need to remove. ...

MySQL Indexes: Having multiple indexes vs. having one multi-field key?

When I manually create tables in MySQL, I add indexes one at a time for each field that I think I will use for queries. When I use phpMyAdmin to create tables for me, and I select my indexes in the create-table form, I see that phpMyAdmin combines my indexes into 1 (plus my primary). What's the difference? Is one better than the other?...

Can I use multiple statements in a JDBC prepared query?

Hi, I'd like to execute something like this on my MySQL server: SET @id=(SELECT id FROM lookupTable WHERE field=?); (SELECT * FROM table2 WHERE id=@id) UNION (SELECT * FROM table3 WHERE id=@id) UNION (SELECT * FROM table4 WHERE id=@id); This works fine from the console, but not from my Java PreparedStatement. It throws an exception...

mysql get non existing results with additional conditions

Hi again, using mysql and php, I have two tables, I'm french so the table names may sound weird, but I would like to keep them as originals to avoid errors when testing… "arborescence" (it means categories) "arborescence_domaine" (it means the subdomains for the categories) The aim of this system is to be able to have great control on...

What steps should you take to speed up SimpleTest?

I'm writing some testing code on a Drupal 6 project, and I can't believe how slow these tests seem to be running, after working with other languages and frameworks like Ruby on Rails or Django. Drupal.org thinks this question is spam, and won't give me a way to prove I'm human, so I figured SO is the next base place to ask a question li...

Forward Back Records in MySQL with the same DATA in the primary

I have a table that is is sorted 1st by Reminder Date then ID Table Looks like: ID | remind_date 1 2011-01-23 2 2010-02-21 4 2011-04-04 5 2011-04-04 6 2009-05-04 I am using a PHP front end to move forward and back thur the records. I want to have forward and back buttons but i am running into a problem with the 2...

User + session handling with ASP.NET and mySQL solution

Hey! I've been reading around the web about different alternatives to keeping track of users but I can't seem to find the "perfect" solution for my situation. The app will (hopefully) be high-volume so I'd like to design with scalability in mind. It might be necessary to host the site using several web-servers so session mode InProc won...

Group by month and year in MySQL

Given a table with a timestamp on each row, how would you format the query to fit into this specific json object format. I am trying to organize a json object into years / months. json to base the query off: { "2009":["August","July","September"], "2010":["January", "February", "October"] } Here is the query I have so far - SE...

how do I update fields with a select for the where clause?

I have tables, 1 called "articles" and another called "links". I want to take the url and title from the table links and update the articles table with the data from the links table. I am unsure how to do this. The links table has article_id referenced to it, can anyone help? Here is some pseudo-code if this helps? UPDATE articles ...

Recover Generated Ids from Multiple Insert Query

I want to execute a query of the form: INSERT INTO table(field1, field2) SELECT field1, field2 FROM table WHERE id IN ( 4, 8, 15, 16, 23, 42 ) Where id is the auto_increment'ing primary key of table. After executing this statement, I want to know what all the new id's that just got generated are. How can I recover this information? I'...