mysql

How to connect Flash Builder 4 application to the remote mySQL database?

I want to get data from a database of my site. In the setting of the project point out Root URL: http://...:** But what to set in Root folder? Already tried the two dozen variants and Validate location does not work. ...

Mysql select order by acts like a string, not a number

How do you order by number if your number can fall below and be bigger than 0? Example Mysql table: |Name|Karma| __________ |Me | -8 | |Bill| 5 | |Tom | 2 | |Saly| 0 | |San.| -3 | Example select query $sql="SELECT karma FROM table ORDER BY karma DESC"; The result I get is this (separated by comma): 5,2,0,-8,-3. Shouldn't...

Error connection to remote DB using MySQL Workbench on a Mac

For many months, I have been logging into my remote servers through a tunnel on my Windows machine. Pretty standard: I log in through putty using the designated port 3306, then I open up MySQL Admin tool (or query tool) and log into 127.0.0.1:3306 I've been trying to set this up on my Mac and I get this error when I try to log into the...

How do I properly join tables and use a group by to summarize data in MySQL?

I am working in MySQL and having a bit of trouble with building a query that will summarize columns from two tables. I want to compare the quantity of requests per day, for a table containing hourly records and a table containing daily aggregation, per day. Ideally the sums of each would be identical. Here is the schema: Hourly Table:...

MySQL regex replace?

I've got a table with blob text fields. This blob has a lot of html in it. One of the pieces of html is an h2. I would like to find all instances of a word in the h2 tag, and replace it with another word (while leaving other words the same). For example, I would like to replace the h2 "wiggles" with "bumbles" in the following: Before: ...

How can you check for foreign key references for a list of records before attempting to delete any of these records in MySQL?

Is there a way, when you have a list of records, to check if each of these records have foreign key references before you attempt to delete any of these records? As an example, if I have a list of borrowers and a list of books, you should not be able to delete a borrower from the system if he still has books on loan. (My actual system i...

mysql Char vs varchar

I know the differnce between CHAR and VARCHAR, CHAR - Fixed length VARCHAR - Variable length (size + 1 byte) But I wanted to know what was the purpse of the having the option for a varchar length e.g. VARCHAR(50), VARCHAR(100), VARCHAR(255) This seems pointless to me because the actual space used depends on the value stored i...

PHP, MySQL & JQuery Question?

I have this script that displays all the users images which i will display below. My question: Is there a way I can display the first 10 images in the MySQL database and have the script hide the rest of the users images until the user clicks the link <a href="#">View All</a> and have the rest of the images slide down when the user click...

Compojure + clojure.contrib.sql: SELECT query is being cached. Why?

I'm writing a Compojure TODO app and with MySQL as the primary data store. I'm using clojure.contrib.sql to interface with MySQL as follows: (def db {:classname "com.mysql.jdbc.Driver" :subprotocol "mysql" :subname "//localhost:3306/todo" :user "<user>" :password ""}) The queries I'm using seem to w...

Is there a SQL technique for ordering by matching multiple criteria?

I have several tables that get JOINed together to form a table with columns designID garmentID colorID sizeID imageID I have a function that looks like this [variables in square brackets are optional]: getProductImages($designID, [$garmentID], [$colorID], [$sizeID]); I want it to return all imageIDs that match $designID in the foll...

Need help with correct SQL query

So I asked a similar question yesterday, and got a great response - I'm hoping for the same luck this time around. What I'm trying to create is paged results for a MySQL query. I'm taking advantage of LIMIT. Here is my query. SELECT BookingInfo.ClinicID, BookingInfo.BookingDate, BookingInfo.BookingTime, BookingInfo.Status, Pati...

Character Encoding Mismatch

My scripts are definitely saved in UTF-8. I'm instantiating PDO with "{$this->engine}:host={$this->host};dbname={$this->name};charset=UTF-8". My tables use InnoDB and are collated using utf8_general_ci. My pages are sent either with the Content-Type: text/html; charset=UTF-8 header or the <meta> equivalent. When using PDO to store a € c...

Multiple Ranks in one table

Hi, I need the following, Can anyone please help me do it. Rank Cust_Type Cust_Name Revenue 1 Top A 10000 2 Top B 9000 3 Top C 8000 1 Bottom X 5000 2 Bottom Y 6000 3 Bottom Z 7000 I need separate rank...

PHP, MySQL & JQuery Image display problem?

My script is supposed to display the first 10 images in the MySQL database and have the script hide the rest of the users images until the user clicks the link <a href="#">View All</a> and have the rest of the images slide down when the user clicks the link. My Question: So my question is that my images won't display when the user click...

SQL Group By - Select Both Columns

I have a table of users containing the following columns: | User_ID (int) | Name (varchar) | Age (int) | Experience_Level (int) | I would like to create an sql query to output all of the IDs of people who are not unique in the combination of age and experience. My code so far: SELECT Count(*), User_ID FROM Users GROUP BY Age,E...

Trigger on INSERT ON DUPLICATE KEY

I have a simple question. Ive got a trigger to insert the values into another Database So for example if there are two values and the trigger is checking the value in Table A and inserting into Table B So here is the code -- Trigger DDL Statements USE `db`; DELIMITER // CREATE DEFINER=CURRENT_USER() TRIGGER `db`.`AFTER_INSERT_A` AFTE...

MySQL:Extracting a sub graph?

I have the adjacency list of a large graph stored in a table. v1 | v2 1 | 2 1 | 3 1 | 4 2 | 5 3 | 5 3 | 6 4 | 7 7 | 9 5 | 10 I am trying to extract the graph 2-hops away from say vertex 1 so that it returns all the edges from the above list except (7,9) and (5,10). I managed this: SELECT * FROM stub_graph WHERE v1...

SQL query works when run as query on server, but will not work from PHP code

I'm running this via PHP and well the first query gets run perfectly then right after it I run the second query and it does nothing. Its rows never get updated for some reason, but when I type out the query manually on the sql server, it works perfectly. Anyone have any idea why its not working in the php code? $qry = "UPDATE Matches S...

How to invoke the application Using Mysql Command

Hi All, I am wrting a trigger, in which i need to invoke the external application using the MySQL Can anyone please help Urgent Regards NewDev ...

MySQL: Efficiently finding rows where the contents of a column is the beginning of a string

I have a MySQL table in which a column contains string prefixes. For instance these prefixes could be top-level directories on an Unix file system: my_table: +---------+ | prefix | +---------+ | /usr/ | | /bin/ | | /var/ | | /lib/ | +---------+ How can I write a query that efficiently finds all rows in this table where th...