I'm wondering if using a CASE statement in SQLite (or other SQL engines) to replace data is not advised. For example lets say I have a query.
SELECT Users,
CASE WHEN Active = 0 THEN 'Inactive'
WHEN Active = 1 THEN 'Active'
WHEN Active = 2 THEN 'Processing'
...
Hello!
I have a function called add_item() which actually inserts values in a field item_name of temporary table called temp having fields temp_id and item_name. I have another table calleed item which consists of fields item_id, item_name, price. I have another table called quotation which consists of fields q_id, item_id,item_name,pric...
I have a table that looks like this:
id count
1 100
2 50
3 10
I want to add a new column called cumulative_sum, so the table would look like this:
id count cumulative_sum
1 100 100
2 50 150
3 10 160
Is there a MySQL update statement that can do this easily? What's the best way to accomplish this?
...
I need to resolve a bunch of column names to column indexes (so as to use some of the nice ResultSetMetaData methods). However, the only way that I know how to get a ResultSetMetaData object is by calling getMetaData() on some ResultSet.
The problem I have with that is that grabbing a ResultSet takes up uneccesary resources in my mind -...
I don't speak SQL... Please, anybody help me. What does this mean?:
Error
SQL query:
/*!50001 CREATE ALGORITHM=UNDEFINED *//*!50001 VIEW `v_sr_videntity` AS select `t`.`c_id` AS `ID`,`User`.`c_id` AS `UserID`,`videntityfingerprint`.`ID` AS `VIdentityFingerPrintID`,`videntityfingerprint`.`FingerPrintID` AS `FingerPrintID`,`videntityfi...
MySqlCommand command = connection.CreateCommand();
command.CommandText = string.Format("SELECT * FROM characters WHERE account_id = '{0}'", this.ID);
MySqlDataReader reader = command.ExecuteReader();
while (reader.Read()) { ... }
I get an error at the last line saying "Invalid attempt to Read when reader is closed."
Now, if I add anot...
hi. with this code:
<?
if (isset($_POST['onay'])) {
foreach ($_POST['secilen'] as $zuha) {
$olay = mysql_query("update mp3 SET aktif = '1' WHERE id = '$zuha'");
}
if ($olay) {
echo "islem tamam";
exit;
}
}
?>
and with this form: (select * from mp3 aktif = '0')
<form name="form" method="post">
<input readonly type="text" ...
Hi, I currently have the following MySQL statement to replace the HTML entity for a single quote with an actual single quote:
update photo_galleries replace(title, ''', '\'');
This statement returns an error. I have tried adding additional backslashes, but this does not help at all. I want to run this command using pure SQL (no PH...
Hi,
After doing a long search on stackoverflow i didn't find any one talked about this even if it's a big choice, the Question is what's the best in order to prevent both of XSS and SQL injection, Escaping the data then store it in the DB or Store it as it is and escape when output it?
Note: it is better if you give some examples of pra...
Hi
here is the table
CREATE TABLE IF NOT EXISTS kompas_url
(
id BIGINT(20) NOT NULL AUTO_INCREMENT,
url VARCHAR(1000),
created_date datetime,
modified_date datetime,
PRIMARY KEY(id)
)
I am trying to do INSERT to kompas_url table only if url is not exist yet
any idea?
thanks
...
Hello,
I'm trying to use the code below for a comment system. It doesn't work. The info I'm trying to insert into the MySQL table "comment" isn't getting put there. Any idea(s) why it is not working?
Thanks in advance,
John
On comments.php:
echo '<form action="http://www...com/sandbox/comments/comments2.php" method="post">
<...
What should the percentile ranks be for each of these records and is there a MySQL query I can run to calculate the percentile for the score?
id score cumulative_score percentile
1 100 100 ?
2 50 150 ?
3 25 175 ?
4 25 200 ?
5 ...
Whats query can be used to get the details of Indexes of any table? I need this to find out primarykey/autoincremented value of any table..
Please help/Guide me...
...
Hi, I'm retrieving a date from a MySQL database that shows up like this: '2010-03-09 09:11:30'
How can I change the date to '2010-03-09 00:00:00'? I'm using PHP to perform the query. Thanks!
...
I have some problem whith such mysql_query
INSERT INTO table VALUES ('', CURDATE()-1)
why if yesteday is last day of the month
the CURDATE()-1) result is like 2010-04-00
why not 2010-03-31
...
The following image have been uploaded to show what I am trying to do and what I wanted out of it
Can any one help me write the Query to get the results what I want
Please check the following
SELECT *
FROM KPT
WHERE PROPERTY_ID IN (SELECT PROPERTY_ID
FROM khata_header
WHERE DIV_ID...
Hi Experts,
I am having an issue with importing a large(60MB) CSV file in MYSQL DB.
The problem arises when an address field has multiple comma seperated values e.g. home no, street no, town etc.
I tried to use BigDump for it but, the problem did not solved because of a single field containing multiple comma separated values.
Any idea...
I got a project of designing a Database. This is going to be my first big scale project. Good thing about it is information is mostly organized & currently stored in text files. The size of this information is 50GB. There are going to be few millions of records in each Table. Its going to have around 50 tables. I need to provide a web in...
Is It Possible to have a primary key and auto increment key associated to two fields respectively?
Like wise, In a table there are 3 fields, say, ID, name and age..
Then is it possible that "ID is autoincrment key and name is primary key"?
...
This question has been bugging me for some time. I always picture launching my site, and some dirt bag coming on and uploading porno or spamming profanity. So I decide I don't want him using my site, I ban his account and ban his ip in my cpanel, but what if he is using a proxy and just keeps making new accounts to harass me? What can I ...