6
голосов
1ответов
1977 просмотров

MySQL performance: Single query using GROUP_CONCAT, or two separate queries?

I have a MySQL database in which each user has an account, and each account can have multiple permissions. My ultimate goal is to end up with the account's username, and a comma-delimited list of permissions ids. There are two ways I can accomplish this: SELECT a.username, GROUP_CONCAT(rp.perm...

1
голосов
1ответов
797 просмотров

PHP & MySQL & forms -- flexible search? (ex: X ingredients can make Y recipes)

I'm just getting started with PHP/MySQL, so please forgive the rather simplistic question: As a practice example, I want to create a small dbase of recipes. Each recipe has X different ingredients. The table is simple enough I think - each row represents a recipe and each column after the first(...

0
голосов
2ответов
86 просмотров

Problem in Creating Table

create table mainTable as select curr_Table.empID as empID, (currTable.ToTalDays-oldTable.ToTalDays) as DiffDays from currTable left outer join oldTable on currTable.empID = oldTable.empID This is the query that i use to find the days worked by an employee. The Problem raises whe...

0
голосов
2ответов
1591 просмотров

How do I install the dependencies I need for MySQL::Slurp?

I am trying to install the mysqlslurp utility found in MySQL::Slurp. I found that it requires Moose and therefore I installed that package too. But I am still not able to use the mysqlslurp command. I get an error: Can't locate Moose.pm in @INC (@INC contains: /usr/lib64/perl5/site_perl/5.8.8/...

0
голосов
6ответов
563 просмотров

Php: get results sets from database via mysql

I am encountering a problem while extracting info from a database using php+mysql and thought it will be good if somebody here may suggest a way out. Problematic Code: $selectedProtocols=array(1,2); for($i = 0; $i<2; $i++) { $result = mysql_query("SELECT throughput FROM session where main...

0
голосов
1ответов
406 просмотров

Install custom modules in a python virtual enviroment

I am doing some pylons work in a virtual python enviorment, I want to use MySQL with SQLalchemy but I can't install the MySQLdb module on my virtual enviorment, I can't use easyinstall because I am using a version that was compiled for python 2.6 in a .exe format, I tried running the install fro...

1
голосов
1ответов
348 просмотров

How can I use multidimensional arrays in PHP with MySQL-based sessions?

So I started using MySQL-based sessions with session_module_name("user"); and I love it, and I might as well because I have to. The only thing I'm missing are my beloved multidimensional arrays, and I'm at a juncture where they are most desired. How can I still use them, or is it a lost cause?

20
голосов
10ответов
17546 просмотров

MySQL driver for Rails in Windows 7 x64

I've got problem with connecting to MySQL database on my freshly installed Windows 7 machine. I'm getting this error when I try to migrate my database. !!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql. rake aborted! 1...

0
голосов
2ответов
448 просмотров

Conditional SELECT MySQL

Don't know if this is possible, but I'd like to select records based on the field value of recur_type, where the 'm' is the day of the week. If it's a weekly recurring event, I need to make sure this is a day it recurs on, otherwise, I want to return all days. however, I'm getting an empty resu...

1
голосов
6ответов
460 просмотров

How Many Days have occured during a Given Timespan

If we have date range such As: 1st October 2009 - 20th October 2009 Can we calculate how many Mondays have occured during The answer to this would be (3) M T W T F S S *1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 *20 21 22 23 24 2...

0
голосов
2ответов
1326 просмотров

What is best approach for Storing data into MySQL after Parsing XML file using SAX Parser?

I have student.xml file and am parsing this file using SAX Parser and now I need to store data into MySQL Database and so what approach is recommended. Code: package sax; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.xml.sax.Attributes...

1
голосов
1ответов
519 просмотров

Django ForeignKey(User), autocomplete

When some user create an object in the admin panel, I want that the author field of that object to be the user's name (The user that created it). How can I do it ? I have something like this : author = models.ForeignKey(User) I want to know what user created each object.

4
голосов
4ответов
8891 просмотров

Is it possible to check if pdostatement::fetch() has results without iterating through a row?

I have a page which needs to check for results, and the way I came up with to do it is successful, but iterates through the first row of results. Is there a way I can check without iterating, or to go back to that first row without executing the query again? I was doing this: $q = pdo::prepare...

0
голосов
5ответов
99 просмотров

Is there a perfomance gain on the language chosen and DB?

We have our current system using PHP and Microsoft SQL Server. I am trying to work out if there will be a performance gain in using PHP and MySQL? It will require some effort to change to this platform so I am hoping to find out as much as I can. Are there any questions I should be asking mysel...

11
голосов
5ответов
2582 просмотров

Algorithm that searches for related items based on common tags

Lets take StackOverflow questions as example. Each of them has multiple tags assigned. How to build an algorithm that would find related questions based on how many common tags they have (sorted by number of common tags)? For now I can't think about anything better than just selecting all questi...

22
голосов
6ответов
15218 просмотров

Using backquote/backticks for mysql queries

I have building MYSQL queries with backticks. For example, SELECT `title` FROM `table` WHERE (`id` = 3) as opposed to: SELECT title FROM table WHERE (id = 3) I think I got this practice from the Phpmyadmin exports, and from what I understood, even Rails generates its queries like this. But...

2
голосов
3ответов
194 просмотров

how to optimize this query (4 mm tables involved)

I am working with a legacy database schema that looks like this: product_table table has fields: uid (int, primary key) name (varchar 50) category table has fields: uid (int, primary key) name (varchar 50) Allright, now the product_table has 4 MM relations to the category table: produc...

0
голосов
3ответов
262 просмотров

MySQL - second sequence in table (e.g. by category)

I'm trying to find the most efficient way to do something and would appreciate your advice! I have a table with the following columns: id category category_sequence other_columns id is an auto-increment column and the primary key. The category is selected by the user on the UI. What I'd like...

0
голосов
1ответов
106 просмотров

Pulling RegEx from MySQL into PHP

I am trying to get the regex string from a table, but as soon as I put it into preg_match it throws an error about an unexpected "\". If I use the exact same string directly there is no issue.

2
голосов
3ответов
6605 просмотров

Index on UNION query?

i've got this union query: (SELECT INSTALLER, INSTALLTIME, RESULT, JOBNUMBER, HONAME, ADDRESS, CITY, STATE, ZIP, NOTES, SMNOTES, '' as priority, PAFS, upsell, TERM, MMRUPGRADE, WARRANTY, EFT FROM ACCOUNTS WHERE INSTALLDATE = '$date' && FUNDINGSTATUS !='DEAD') UNION (SELECT technician,...

3
голосов
2ответов
7530 просмотров

how to do a select on like values from multiple columns in sql

I have two tables with columns: Genres ID genre and Adjectives ID adjective_title I need to do a select that returns the matching values from both tables columns with the like syntax. For example if ep was the value entered using like the results would look like: result_column...

1
голосов
3ответов
1202 просмотров

Mysql Plug-in for Qt

I've installed recent Qt (4.5.3) sdk windows version. I'm want to use mysql in my app. Since Qt Mysql plugin in not available, so I compiled it from the included source. I copied compiled files D:\\Qt\2009.01\qt\plugins\sqldrivers. Now when I run my application it still error "QMYSQL driver not ...

1
голосов
2ответов
4883 просмотров

MySQL Deadlock Detection via PHP

What is the best-practice in dealing with MySQL Dead-Locks in PHP? Should I wrap all database calls in a try{}catch{} block and look for the DeadLock error code from the database? Do I then reissue the whole transaction again (I presume the one that failes rolled back)?

3
голосов
3ответов
10174 просмотров

A MySQL IF condition

In my query I have an IF statement: IF(friend.block, 'yes', 'no') where friend.block value is 0 or 1.. but either way its putting 'yes'.. any idea?

1
голосов
1ответов
406 просмотров

Common-practice in dealing with high-load tables in MySQL

I have a table in MySQL 5 (InnoDB) that is used as a daemon Processing Queue, thus it is being accessed very often. It is typical to have around 250 000 records inserted per day. When I select records to be processed, they are read using a FOR UPDATE query to eliminate race conditions (everything...

9
голосов
4ответов
5355 просмотров

Mantis - Integrate Wiki

I am using Mantis (PHP and MysQL) as a bug tracking tool and I would like to extend it in order to document requirements and technical specifications. Ideally, I should be able to link a defect with a requirement. Is there a way to integrate a Wiki tool (preferably PHP and MySQL based) into Mant...

1
голосов
2ответов
976 просмотров

monthly breakdown of table data, date stored as epoch time

I have a mysql table that contains a date field in epoch time format. I need to count how many rows I have for each calendar month of the year. I don't even know where to start. Thanks in advance.

0
голосов
1ответов
1385 просмотров

MySQL-SSL Configuration on Windows Machine ( openSSl, Mysql 5.1, IIS 5.0)

how to setup openssl at the mysql? "have_ssl" disabled; how to enable it? " mysql> SHOW VARIABLES LIKE 'have_ssl'; If the value is YES, the server supports SSL connections. If the value is DISABLED, the server supports SSL connections but was not started with the appropriate --ssl-xxx optio...

1
голосов
4ответов
205 просмотров

How to optimize this SQL query?

I have a database with questions and answers that get translated into all languages that site is used by. But when a question is not translated yet I want to show that question in english language. So a gettext-like behavior. My current SQL query for this looks like this: SELECT * FROM question...

0
голосов
3ответов
1486 просмотров

MySQL Inner Query with a Where and Group by conditions in cakephp

i am having a table named Reports with id report_id user_id 1 1 5 2 1 5 3 1 5 4 2 5 5 2 5 6 3 6 7 3 6 8 4 1 9 4 1 10 4 1 i am trying to write a Query such that user_id...