I have a set of stored procedures that I am using to populate an ASP.Net CheckBoxList. When running this procedure from code as { CALL ProcedureName(params); } with the type set as stored procedure, I only seem to be getting a partial result back (i.e. many columns from the actual result are missing.)
If I copy the CommandText from the ...
In short, what are the steps that one needs to take in order to modify the source of the connector and install it in Windows?
I have the MySQL Connector/.NET Version 6.1.2 installed on my machine, but I'm getting an exception for every DateTime with a value of '0000-00-00'. This exception breaks my application.
As I solution, I downlo...
I have a table with the following structure
id(int) | col1(int) | col2(int) | col3(int)
------------------------------------------
1 | NULL | 10 | 20
2 | 5 | NULL | 30
3 | 8 | NULL | NULL
Given an 'id' value I need to find the minimum non-null value across all the columns in tha...
I have two database tables, users and logs. I need SQL code to do something along the lines of
foreach(id in users)
insert into logs a record with user_id = id;
endforeach;
I could use php to implement the foreach but I figured there is probably a pure SQL way of doing this. I'm running a MySQL server if that helps.
...
I'm trying to keep track my students, and those that have not yet booked a lesson with me (I'm a music teacher as well as a CS student) but my attempt is actually giving me all those that HAVE already booked lessons, what is my mistake?
SELECT DISTINCT student.person_id FROM student, lesson
WHERE lesson.student = student.person_id
AND...
I have a table which contains the items the users of my game owns. If a user buys a new item, it should be inserted, but if he already got it, it should be increased instead.
I understand I can use INSERT ... ON DUPLICATE KEY UPDATE, but I don't understand how in my problem.
The item_id isn't unique, because many players can own the s...
I need to clear all my inventory tables.
I've tryed
SELECT 'TRUNCATE TABLE ' + TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME LIKE 'inventory%'
but I get this error:
Truncated incorrect DOUBLE value: 'TRUNCATE TABLE ' Error Code 1292
if this is the correct way, then what am I doing wrong?
...
I've searched all around for a solution to this problem, but I can't seem to find one. Basically, it's this: I have a database that contains two fields that collect multiple values. For instance, one is colors, where one row might be "red, blue, navyblue, lightblue, orange." The other field uses numbers, we'll call it colorID, where one ...
Thanks for looking. All helpful answers/comments are up voted.
In php, you can use NOW() like this:
mysql_query("INSERT INTO tablename (id, value, time_created)
VALUES ('{$id}', '{$value}', NOW())");
How can I do the same thing in PDO. When I bind like this, I get an error:
$stmt->bindParam('...
I've recently noticed that a query I have is running quite slowly, at almost 1 second per query.
The query looks like this
SELECT eventdate.id, eventdate.eid, eventdate.date, eventdate
.time, eventdate.title, eventdate.address, eventdate.rank, event
date.city, eventdate.state, eventdate.name, source.link, type,
eventdate.img
FROM s...
Basically I'm trying to pull a random poll question that a user has not yet responded to from a database. This query takes about 10-20 seconds to execute, which is obviously no good! The responses table is about 30K rows and the database also has about 300 questions.
SELECT questions.id
FROM questions
LEFT JOIN responses ON ( questi...
My query:
SELECT issues.*,
comments.author AS commentauthor,
comments.when_posted AS commentposted
FROM issues
LEFT JOIN (SELECT *
FROM comments
ORDER BY when_posted DESC
LIMIT 1) AS comments ON issues.id=comments.issue
ORDER BY IFNULL(commentposted, issues.when_opened) ...
I'm trying to connect to a mySQL database at http://bluesql.net, but when I try to connect, it gives this error:
Connect Error (2000) mysqlnd cannot connect to MySQL 4.1+ using old authentication
I've looked into this, and it has to do with some old password scheme used before MySQL 4.1. Newer versions have the option to use old passw...
I am trying to change the background color of a td element in a static html table. I will be finding the td's invovled through a database call and need to show the td by way of turning the background color from none to yellow. I have built a css file to match the td class attribute so I can isolate the table cell by class id:
For exampl...
Hello
I am running into a couple of issues while trying to generate foreign keys for my tables in MySql(Innodb). Can you please help me with them ?
Referenced tables :
*create table entity
{
PID INT(20) auto inc not null,
ENTITYID INT(20) not null,
details VARCHAR(100) not null,
primary key(PID,ENTITYID)
}
create table user
{
...
I'm fairly new to (J)Ruby - have written a few tiny "demo apps" in RoR
but haven't really gotten right into the syntax though.
I have an app at the moment written in Java that takes an XML file,
parses it and then inserts it into a MySQL database using Hibernate.
What I'd really like to do is see if I can port this to JRuby, -
mainly as...
I am doing some experimentation with VPS before moving my application from private Tomcat hosting to cloud. It is a read intensive app built on Struts 2 + Spring + Hibernate + MySql. Its a moderately popular app in India with 1500 visitors and 10,000 pageviews per day. I have some basic questions about choosing a server configuration.
1...
I'm running into a problem because my database has BIGINT data (64-bit integers) but the version of PHP I'm running is only 32-bit.
So when I pull out value from a table I end up with a numeric string representing a 64-bit integer in base 10. What I would ideally like to do is use the 64-bit integer as a bitmask. So I need to go to ei...
Here is the below Code:
$query = mysql_query("SELECT * FROM tablex");
if ($result = mysql_fetch_array($query)){
if ($result['column'] == NULL) { print "<input type='checkbox' />"; }
else { print "<input type='checkbox' checked />"; }
}
If the values are NOT NULL i still get the uncheked box. Am i doing something wrong from a...
I was about to ask the MySql list this and remembered about SO.
Running MySql 5.0.85, I need to be as efficient as possible about a few queries. If I could get a little review, I would appreciate it.
I collect data in the millions, and need the top 50 grouped by one field, with a percentage of how much those top 50 occupy.
Here is wh...