mysql

How to insert incoming e-mail message into mySQL database ?

Just to say... I have no idea how would I do this :). In other words, the thing is: You get a mail message from some guy [email protected], you make a reply with your own content, and [email protected] have your reply stored in his database. Additional: I use shared hosting, I code in PHP, I understand ASP. If you have an idea how to write...

SQL AND on column from join table

I'm having trouble getting the correct results in my query. I'm using Mysql and here is what I have so far: SELECT cpn, status, title, value_category, rating_category, parts.id FROM `vendors` INNER JOIN `vendor_parts` ON (`vendors`.`id` = `vendor_parts`.`vendor_id`) INNER JOIN `parts` ON (`parts`.`id` = `vendor_parts`.`part_id`) WHE...

MySQL's alternative to T-SQL's WITH TIES

I have a table from which I want to get the top N records. The records are ordered by values and some records have the same values. What I'd like to do here is to get a list of top N records, including the tied ones. This is what's in the table: +-------+--------+ | Name | Value | +-------+--------+ | A | 10 | | B | 30 ...

Is there any point in creating a second column optimized for FULLTEXT searches?

Hi, the project I'm working on has for each column that needs to be searched a second column called "ft[columnname]" which has a FULLTEXT index and only this one is searched against. This column contains an "optimized" text, that is automatically generated from the original column in the following way: The string is lowercased All acc...

[PHP-MySql] Can SQL tell me how many row(s) were updated?

I would use only a single query: $sql = "UPDATE gallery SET order = (order+1) WHERE id_categ = ".$id; $res = mysql_query($sql); ... Is it possible? ...

How do you get the max_length for a mysql field

MySQL is returning the current field value length in property max_length. I there a way to get the correct values ? ie Field part_code is a varchar(32) that returns 3 if it contains the value of "ABC" instead of the expected result of 32 EDIT original mysql //--------------------------------------------------------------------------...

Selecting a mysql row from one table based on select statement in another

I am trying to select a tshirts which the user has not voted on yet (from another table "votes") "submissions" is the table with the tshirts "votes" is the table that holds votes "votes" structure is: ID, TEE, USER (where votes.tee == submissions.id) This is the mysql statement I am trying: SELECT submissions.name, submissions....

Data object storage - Can table JOIN's do what single table SELECT's cannot?

Now that "NOSQL" or "object only" storage systems like MongoDB or memcached are really picking up steam in the world. I was wondering if there are any requests that cannot be performed on them that can be performed using multiple object joins (in SQL that is JOIN "table"). In other words, are there any multi-table queries that cannot be ...

MySQL Multiple Left Outer Join Query Question involving 3 tables

Due to 0 responses, I'm guessing that my LEFT JOIN question got into too much detail about a database that was too esoteric. I've already programmed around the issue, but I'd still like to know how to join in a similar scenario: Assume a basic surrogate key strategy (each table has an id field that just auto-increments), as well as a f...

SQL: Filtering groups based on aggregate function

Using MySQL So i'm trying to improve upon a query I've written. My current query works, but i feel like i could be more efficient Essentially, I have a table that lists 'who talks to who and how much'. The records look like this: email name status count prod_ref (I'll post an example set with example output at the end of the...

mysql: how do i start auto increment from a specific point?

CREATE TABLE `batchinfo` ( `rowid` int(11) NOT NULL AUTO_INCREMENT, `datapath` mediumtext, `analysistime` varchar(50) DEFAULT NULL, `reporttime` varchar(50) DEFAULT NULL, `lastcalib` varchar(50) DEFAULT NULL, `analystname` varchar(150) DEFAULT NULL, `reportname` varchar(150) DEFAULT NULL, `batchstate` varchar(150) DEFAULT...

Mysql Workbench Reverser Engineering.... Foreign key problem!

Does anyone know how to import foreign keys on the reverse engineering tool on mysql-workbench ? The table is already InnoDB and everything ...

How to create mobile web and transaction on java

I'm working in database mysql. I want to know how to create database connection through mysql. Because when I make connections there is a error. thanks.. ...

Insert into two tables from a single form

Insert into two tables from a single form. The first insert go in fine the second generates this error Duplicate entry '0' for key 1 any idea what is happening? $connection=mysql_connect ("localhost", "foo", "bar") or die ("I cannot connect to the database."); $db=mysql_select_db ("database", $connection) or die (mysql_error()); $query ...

MySQL ignores my index

I'm running the following query in MYSQL select distinct straight_join cu.entryid entryid, t0.tokpos starting_position, t3.tokpos ending_position, t0.idxsent idxsent, 'TOKENS_44_340' tablename from TOKENS_44_340 t0, constraints_appraisal cu, TOKENS_44_340 t1, TOKENS_44_340 t2, TOKENS_44_340 t3 where t0.toke...

PHP / SQL (MySQL) function optimization help required

I'm currently trying to optimize a "bottleneck" function that is called really ofen in an application. In the application in question, options can be selected. But some options can be restricted by other. For example, when option "A" is selected, it restricts the selection of option "B". These restriction links are saved to a table whi...

Mysql query with different searchs in same table

What I'd like to do is search in a table with two different values, it's hard to explain so I will just give an example. Table: people +----------------+ | id name | |----------------| | 1 Bob | | 2 Jack | | 3 Waly | | 4 Alex | ++++++++++++++++++ Table: animals +-------------------------------...

Building a long query and have a lot of if statements - is there a more elegant way?

I have to build a query based on certain conditions. Is there a better way of doing it than the way I have done below? It works fine but I can see it getting out of hand fairly quickly if there were more conditions since I check if any previous conditions had been met every time I check a new one. $sql = "SELECT DISTINCT fkRespond...

In MySQL, need to join two tables with one table having multiple references to the second

I have two tables, one is signups and contained in it are two fields, firstchoice, and secondchoice. Another is a schedule table, and it has things like a begin and end date, and a semesterid. firstchoice and secondchoice from the signups table both reference the semesterid from the schedule table. I am trying to create a page which d...

MySQL: Select occurences of a row, then combine results with another query

I am totally lost in how I should do this. I'm trying to display a top 100 most liked songs list. I have this part to find the most 100 liked songs: SELECT like_song_id, COUNT(like_song_id) AS occurances FROM likes GROUP BY like_song_id ORDER BY occurances DESC LIMIT 100; That works fine, I get a list of the top songs in the right or...