mysql

php mysql query updating multiple tables

Guys I am new to php so bare with me if this question sounds weird. I have the following mysql query which I am running with php like so. Notice that the update query is updating multiple tables at the same time. $sql1 = <<<TEST1 UPDATE catalog_topics a LEFT JOIN catalog_files_join b ON a.catalogID = b.foreignKey LEFT JOIN catalog_...

AN error about "User.add_to_class" to extend my user?I do not know why.

In my models.py, I user these code to extent two fields: User.add_to_class('bio', models.TextField(blank=True)) User.add_to_class('about', models.TextField(blank=True)) But when I creat a User : user = User.objects.create_user(username=self.cleaned_data['username'], \ email=self.cleaned_data['email'],password=self.cleaned...

Convert MS SQL script to Mysql and Oracle

One of the applications I develop gets installed locally on the customers site. This means that we have to support MySQL,MSSQL and Oracle as not all the customers use the same database engine. I'm writing a patch for the application, part of which involves executing a 5000 line sql script to make modifications to the database. The scrip...

How to write a query showing records from table A without a matching record in table B?

Say I have two tables called A (fields: id, phase, name) and B(fields: id, AID, APHASE, void). I need to show all records from A except for records where A.id = B.AID and A.phase = B.APHASE and void = 0. Environment is MySQL. ...

SQL Query problem?

I have the following table: UID | Limit |Type 8 | 4 |A 8 | 5 |B 8 | 6 |C I want a query, that will return all of these values, but in one row, like this: UID | A | B | C 8 | 4 | 5 | 6 Anybody know how to do that with SQL? I use MySQL. ...

mysql: duplicate certain rows using SQL?

I have a table that looks like this: nid vid tid 1 2 3 2 2 4 3 2 4 4 2 3 I'd like to run some SQL that will take each one of those rows and create another based on it like so: foreach row where vid=2, create a duplicate row where vid = 3 So I'll end up with this: nid vid tid 1 2 3 2 2 ...

MySQL explain anomaly

Consider the following query: select FEE_NUMBER from CARRIER_FEE CF left outer join CONTYPE_FEE_LIST cfl on CF.CAR_FEE_ID=cfl.CAR_FEE_ID and cfl.CONT_TYPE_ID=3 where CF.SEQ_NO = ( select max(CF2.SEQ_NO) from CARRIER_FEE CF2 where CF2.FEE_NUMBER=CF.FEE_NUMBER and CF2.COMPANY_ID=CF.COMPANY_ID group by CF2.FEE_NUMBER) g...

How could I change this mysql to mysqli?

Based on this code below I use for regular mysql, how could I convert it to use mysqli? Is it as simple as changing **mysql _query($sql); to mysqli _query($sql); ?** <?PHP //in my header file that is included on every page I have this $DB["dbName"] = "emails"; $DB["host"] = "localhost"; $DB["user"] = "root"; $DB["pass"] = ""; $link = ...

Dreamweaver Recordset Default Value (PHP) - How to Return All Records?

Greetings! Although I am working in Dreamweaver, this question may be general enough for PHP/MySQL experts to comment on. $colname_get_voice_search_men = "-1"; if (isset($_POST['search_type'])) { $colname_get_voice_search_men = $_POST['search_type']; } mysql_select_db($database_conn_talent, $conn_talent); $query_get_voice_search_men ...

selecting minimum from a query with group by

I have the following query: SELECT a.topicID, d.catalogFileID, d.catalogFileExtension, a.sortorder FROM catalog_topics a LEFT JOIN catalog_files_join b ON a.catalogID = b.foreignKey LEFT JOIN catalog_files_join c ON c.foreignKey = b.catalogFileID LEFT JOIN catalog_files d ON d.catalogFileID = b.catalogFileID WHERE b.fileTypeID = 'gvl401...

how to backup your mamp pro mysql dbs?

while I find the apache portion of mamp pretty easy to backup, what is everyone using or how are you performing a scheduled backup of your mysql databases? It would be kinda annoying to export each DB one by one. thank you ...

Limiting the size of a mysql table

Is it possible to limit the size (in disk size / rows) of a single mysql table? If it is not possible, what is the easiest way to run multiple mysql engines on one physical computer? (my plan is to set one mysql instance's data files to a separate disk partition) ...

help creating a custom auto increment function in mysql

Hello, I would like to create an auto increment function that allows me to maintain uniqueness in designated columns across multiple tables. I understand that this is not supported under mysql's standard functions, but it appears that this can be done by hand. Could someone point me in the right direction? Thanks ...

how to connect mysql workbench with mamp pro?

what is the fix to connect the mysql workbench tool with the mamp pro mysql db? ...

MySql and Entity framework randomly gives Schema specified is not valid error

I'm using Entity Framework to access my MySQL database. The model was generated using EDMGEN2 and everything works great. I can do all my linq-to-entity query goodness... ...until an indeterminate amount of time passes and I get "The ProviderManifestToken '5' is different from '5.1' that was encountered earlier" error. Why is it encount...

What is everyone using for MySQL development on OS X?

What is everyone using for MySQL development on OS X? I have been using MySQL Workbench, but was wondering what fellow geeks are using? ...

How to think of aggregate functions in terms of sets

I am trying to think data in terms of sets but have some questions about aggregate functions. here is the definition from wiki an aggregate function is a function that returns a single value from a collection of input values such as a set so for example, select c.id, c.user_id, c.name, c.created_at, count(c.id) from colle...

Mysql - Find unused tables and columns

Let's say we have "system A" comprising a MySQL database, with several tables. After a while you want to optimize system A by removing any unused tables and/or columns, system A being quite large and difficult to overlook. Is there a tool or method that lets you run the system for a while, and then do an analysis which prints out general...

Shopping Cart Structure Problem, Size selection etc.

Hello, I'm working on a shopping cart and my problem is, how should I design database for size selection for products? Tshirts can be "XL, L, M, S" etc. and shoes can be "36,37,38,39...blabla" Should I do just one size table or many tables for several types (tshirt, shoes etc.)? Thanks in advance... ...

How do I insert NULL values using PDO?

I'm using this code and I'm beyond frustration: try { $dbh = new PDO('mysql:dbname=' . DB . ';host=' . HOST, USER, PASS); $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $dbh->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'"); } catch(PDOException $e) ...