Ok, I have a problem that i've searched and searched for solutions to online and can't find any leads, here it is (oh, and i'm very new to this database stuff ;-)
Lets say I have thousands of retail stores and each one can carry 1 to 100 products, but there are 10,000 possible products available. I need each store owner to be able to se...
I have this class for page titles:
class UI {
private static $title;
public static function getTitle() { return self::$title; }
public static function setTitle($value) { self::$title = $value; }
}
So in my frontpage I simple declare this:
UI::setTitle('Kiubbo.com :: Todas las Noticias, Fotos y Videos');
And works ...
I have a MySQL table with multiple fields, and I'd like to find any entries that duplicate a tuple.
I was initially thinking I could do this
select f1, f2, f3 from mytable t1 left join mytable t2
where t1.f1 = t2.f1 and t1.f2 = t2.f2 and t1.f3 = t2.f3;
But then I realized that will just return all the rows in the table (I think).
I...
This is my command line query.
mysql> load data local infile "c:\\re\\30-11-08.csv"
into table powerdata(Date, DG1, DG2, DG3, Dg4, DG5, ChillerPanel1,
ChillerPanel2, ChillerPanel3, ChillerPanel4,1st_Floor, 2nd_Floor,
3rd_Floor, 4th_Floor, UPS1, UPS2, UPS3, UPS4, UPS5,Server_Power,
Cooling_Power)
fields terminated by...
I'm using a rather busy MySQL 5.0 database. What are the main reasons for me to migrate to MySQL 5.1? Does it worth the trouble?
I use VS2008/.NET 3.5
Servers run as a MySQL cluster on Windows 2008 servers.
Thank you for your answers so far. To be more specific - I'm looking for answers such as the one by Quanssnoi, listing the feature...
Hi,
I am trying to search employees based on their code and department.
I triggered a query using IN operator which has 1200 employee codes. When i executed the query I got an exception ("Maximum 1000 records allowed in IN ").
Can anyone help me out with this issue.
...
My co-worker is having an issue managing customers in his data-base. The issue is when an order goes through the customer needs to be added to the data-base. But if the customer exists we don't want to make a duplicate customer we want to keep the same customer and just add to their sales history. He is having a hard time figuring out ho...
I want to be able to select all database rows where the month and year are the same as what I am searching for. Since the DATE field has year, month, and day, how do I search with year and month?
...
for example this query:
Select
product_brand,
(CASE WHEN COUNT(product_brand)>50 THEN 1 ELSE 0 END) AS brand_count
FROM
products
WHERE
1
GROUP BY
product_brand
This brings up 2 columns one called product_brand and one called brand_count, brand_count is created on the fly and is always 1 or 0 depending on wh...
Is there a way in SQL (MySQL) to do a "round robin" ORDER BY on a particular field?
As an example, I would like to take a table such as this one:
+-------+------+
| group | name |
+-------+------+
| 1 | A |
| 1 | B |
| 1 | C |
| 2 | D |
| 2 | E |
| 2 | F |
| 3 | G |
| 3 | H |
| ...
Hi! I'm trying to execute two SQL statements in one mysql_query.
$mySql = mysql_query("SELECT itemid, points FROM items WHERE id='1' UPDATE accounts SET userpoints = '1000'");
Is this possible? Thanks!
...
I have a table like so:
object_id | vote
1 | 2
1 | -1
1 | 5
2 | 3
2 | 1
3 | 4
3 | -2
I want this result (for this particular example, object_ids 1 and 2 are part of a group, defined elsewhere, and I'm looking for the normalized_score so that the sum always = 1. object_id 3 is part of an unused group.):
object_id | normalized_score
1...
I am working with Sphinx and would like to implement string sorting. I understand that this can be accomplished using attributes and String Ordinals, however, I also want to implement Live Index Updates and string ordinals do not work with multiple indexes.
What would be the best way to approximate string sorting with multiple indexes?...
Having a production table, with a very critical column (date) missing an index, are there any ways to apply said index without user impact?
The table currently gets around 5-10 inserts every second, so full table locking is out; redirecting those inserts to alternative table / database, even temporarily, is also denied (for corporate po...
I have an array which contains the categories for a particular article ($link_cat). I'm then using mysql_fetch_array to print out all of the categories available into a list with checkboxes. While it's doing this I want it to compare the value it's on, to a value from the other array. If there is a match, then it means that one of the ca...
I want to run a cron job that does cleanup that takes a lot of CPU and Mysql resources. I want it to run only if the server is not relatively busy.
What is the simplest way to determine that from PHP? (for example, is there a query that returns how many queries were done in the last minute? ...)
...
I would like to fill a table with the results of a query on existing table. How can I do that?
...
I am trying to add the following custom sql to a finder condition and there is something not quite right.. I am not an sql expert but had this worked out with a friend who is..(yet they are not familiar with rubyonrails or activerecord or finder)
status_search = "select p.*
from policies p
where exists
...
Intro note: I'm hoping a library or routine exists to do this, but I haven't been able to find anything like this. I'm really looking for direction and advice on where to start...
Here is the situation:
I have a block of SQL commands coming as plain text. It might be one SQL commands or several. I need a way to split multiple SQL comman...
What is the best way to escape strings for sql inserts, updates?
I want to allow special characters including ' and ". Is the best way to search and replace each string before I use it in an insert statement?
Thanks
Duplicate of: http://stackoverflow.com/questions/568995/best-way-to-defend-against-mysql-injection-and-cross-site-scrip...