mysql

Regular Expression for exclude something that has specific word inside bracked (MySQL)

This Regular expression if for MySQL query: I want to exclude this row because it has 'something' in side the bracket "bla bla bla bla bla bla (bla bla bla something)" However I want to include this row, because it does not have 'something' inside the bracket "bla bla bla (bla bla bla)" I tried this query but it didnt work. SELECT * ...

SQL Latest photos from contacts (grouped by contact)

Hello, To short version of this question is that I want to accomplish something along the lines of what's visible on Flickr's homepage once you're logged in. It shows the three latest photos of each of your friends sorted by date but grouped by friend. Here's a longer explanation: For example I have 3 friends: John, George and Andrea. ...

joomla virtuemart site loading issue

I have a Joomla site, integrated with virtuemart in it. have almost 9,000 products. it is not loading the site when i select a manufacturer from a module, which must list all products. Same problem is in the case of categories(have 2 categories). error is FastCGI Error Number: 258 (0x80070102) when I have only 250 products, it was fas...

Searching a column containing CSV data in a MySQL table for existence of input values

Hi, I have a table say, ITEM, in MySQL that stores data as follows: ID FEATURES -------------------- 1 AB,CD,EF,XY 2 PQ,AC,A3,B3 3 AB,CDE 4 AB1,BC3 -------------------- As an input, I will get a CSV string, something like "AB,PQ". I want to get the records that contain AB or PQ. I realized that we've to write a MyS...

MySQL - Counting rows in preparation for greatest-n-per-group not working?

Referring to SO and other sites have given me examples of how to use MySQL to create a 'greatest-n-per-group' query. My variant on this would be to have a query that returns the first 3 rows of each category. As the basis for this I need to sort my data into a usable sequence and that is where my problems start. Running just the seque...

Secure way to backup MySQL databases?

What is the best/secure way to backup a mysql database on windows server (2008)? I have "MySQL Administrator" but that requires that you save passwords for backup project. I'm not keen on doing as anyone gaining access to the server would then have easy access to the database. Can you do anything similar to SQL Server like using Windows ...

Error 1130 in mysql

when i am trying to log on mysql using my ip address i am getting error 1130 qht can i do for this ...

How to make a tree view from MySQL and PHP and jquery

hey guys i need to show a treeview of my categories , saved in my mysql database . Database table : table : cats : columns: id,name,parent problem is in php part : //function to build tree menu from db table test1 function tree_set($index) { global $menu; $q=mysql_query("select * from cats where parent='$index'")...

Scanning a mysql table from the bottom

When i run a mysql select statement, it takes very long because i have already previously deleted a very large number of rows. Is there a way for the table to start scanning from the bottom, as opposed to from the top? ...

question about group by

Hi in mysql how to write a sql like this, to get the amount of X > 20 and <20 select date, numberOfXMoreThan20,numberOfXLessThan20, otherValues from table group by (date, X>20 and X<20) my way, but i think it's not good select less20.id_date, a,b from (select id_date,count(Duree_Attente_Avant_Abandon) as a ...

Mysql question about UPDATE

UPDATE counter_reports SET `counter`=`counter`+1,`date`=? WHERE report_id IN( (SELECT report_id FROM counter_reports WHERE report_name="emails_sent" AND `year`=1 ORDER BY report_id DESC LIMIT 1), (SELECT report_id FR...

How do I get PHP variables from this MySQL query?

I am working on an Asset Database problem using PHP / MySQL. In this script I would like to search my assets by an asset id and have it return all related fields. First I query the database asset table and find the asset's type. Then depending on the type I run 1 of 3 queries. <?php //make database connect mysql_connect("localhost...

Can i insert an image in a MYSQL DB table?

is there a way to insert pics(not url,the pic)into a MYSQL table made with phpmyadmin? and if there is when i want to get that picture and insert it in the page , what should i do? :) ...

Seeking SQL query to create a matrix type report of users and the tools they use indicated with a '1' at each intersection.

Hi all, The title kinda says it all. I need to generate a report that is roughly 100 columns wide(tools) and many thousands of rows deep (users) having a '1' displayed at each intersection where a user is related to a tool. Tool1 Tool2 Tool3 Tool4 ...Tooln user1               1               1 user2     ...

How to mysql Update table field with JSON data from Serialized data field??

Hi there, Here's my situation: - a table with a varchar field in which i store serialized data from php now I have to add another field to the mysql table in which i store JSON data also from php As the table already has serialized data stored i was wondering if i can unserialize > json_encode and store the data in the new db field?...

Build a Sitemap but webpages don't use links

Folks I am trying to build a sitemap (we need one badly) for a huge multi-page web app. Technically its not much more than a collection of php/MySQL web forms that use javascript instead of traditional linkage to access the many pages. <td width="100" align="center" ONMOUSEOVER="this.className='bgover'" ONMOUSEOUT="this.className='bgou...

select random value from each type

I have two tables, rating: +-----------+-----------+-------------+----------+ | rating_id | entity_id | rating_code | position | +-----------+-----------+-------------+----------+ | 1 | 1 | Quality | 0 | | 2 | 1 | Value | 0 | | 3 | 1 | Price | 0 | +----...

Moving mysql files across servers

I have a massive MySQL database (around 10 GB), and I need to copy it to a different server (slicehost). I don't want to do a DB dump and reimport b/c I think that would take forever. Is it possible to just move the raw SQL files from one machine to the next, setup an identical mysql server, and flip the switch? ...

Whats the best way to generate a XML output of a MySQL database using PHP.

A bit on my requirements, at the moment i'm passing on a search string from a Cocoa app to a PHP script which queries the database, and then generates an XML output for Cocoa again. The only bit I am having issues with now is generating the XML output from the db query. At the moment, i'm trying to loop through the results and output t...

Is there something in MySQL like IN but which uses AND instead of OR?

I need a SQL statement to retrieve records where it key (or any column) is in a associate table, for example: documentId termId 4 1 4 2 3 3 5 1 This: SELECT documentId FROM table WHERE termId IN (1,2,3) ...will retrieve any documentid value where the termid value is 1 or 2 or 3. ...