Hi,
I know the title is confusing, but I have a column in which all rows are zero except one, which is equal to "1". I would like a formula to set a cell equal to the next column in that row (which is equal to 1).
For example, take the following data (seperated into two columns):
0 | Bob
0 |...
Hi,
I'm at work, and I left my computer to go to eat lunch. For some reason, when I returned all of my files in My Documents on my local drive were automatically deleted. Does anyone know why this could have possibly occured? No one else had access to my computer while I was gone.
I was wondering about the filtering sequence that MySQL performs on AND gates. For example, consider the following query:
select *
from expl_table
where ColA > 30
and ColB < 15;
Does MySQL first select rows where ColA > 30, and then further filter the resultset for ColB < 15, or does it...
I want a mechanism for recording the history of our employees' salaries. Using this mechanism, I should be able to easily obtain a salary given an employee's ID and a date. Any suggestions?
I am creating a temporary table which is simply a copy of two tables joined together, excluding rows which meet a certain criteria. For some reason, it is much faster for me to make a full copy of the joined tables, and then delete from the table the rows which meet the criteria, than it is to...
I have an "employees" table which records which department each employee has worked in, and the date that each employee started working in their departments. Since it is possible for an employee to change departments, a single employee can have several records in this table. For example...
I wrote the following simple bash script to send mail:
#!/bin/bash
SUBJECT="testsubj"
EMAIL="username@domain.com"
EMAILMESSAGE="/tmp/emailmessage.txt"
echo "testbody">$EMAILMESSAGE
/bin/mail -s "$SUBJECT" "$EMAIL" < $EMAILMESSAGE
The script runs fine (no errors are returned), but...
I have a tab-delimited .txt file with 3 columns, which I want to import into a table with 4 columns. All of the table's 4 columns are included in a unique key. The .txt file looks like this
Bob Billy 23945
Adams John 34535
Smith Chris 34593
The column headings for the...
This might be a Linux question, as it has to do with where MySQL stores its database tables when you install it in a Linux based OS (Cent OS).
I want to put the MySQL tables and database information on a separate hard drive. I'm thinking the easiest way to do this is to mount the folder where...
I am writing a bash script to update a MySQL table using a previously defined variable. For some weird reason, the value that is populated in the table does not match the value of the variable. Here is my code:
var_date="2007-03-15"
mysql -u username -ppassword dbname -e "update...
I am writing a bash script to automatically import a tab-delimited file into an MySQL database. The problem is that I want to add a date column to the file before I import it into the database. The date is included in the filename.
For example, assume a file named patientinfo_20070217.txt...
Is there a Linux bash command to set the modification time of FileA to that of FileB?
For example, assume FileA was last modified at 5:30, and FileB was last modified at 6:30, and currently it is 7:30. I would like to change the modification time of FileA to 6:30.
I want to select all columns from a table, EXCEPT three, which are called "id", "name", and "active".
I can't simply tell MySQL to select all the other columns, because I do not know beforehand how many columns there will be, or what they will be called.
Is there something like this that I can...
I am trying to update two columns of a table (date and location) so that they are equal to the date and location of another table on a lastname join. Here's is the code I have right now:
update tblA
set tblA.date = tblB.date, tblA.location = tblB.location
where tblA.lastname = tblB.lastname...
What's the proper way to use a variable in a procedure?
Whenever I try and initialize one, I'm getting an error that I'm not using the proper syntax. Because I can't initialize it, whenever I try and use it I'm getting a null result. The variable is to be used inside a case when statement that...
Consider the following pseudo-code for an IF statement:
if(maintable.call_type contains at least one instance of 'E')
then ...
Call_time is a column within maintable.
For example, if maintable.call_time contained the values {A,A,B,D,A,B,E,B,C,E,D} then the statements inside the...
I know this is really simple, but I've been suck on this for 2 hrs and I can't figure it out. I'm getting a syntax error when declaring a variable within an UPDATE statement. Here's how I'm declaring it:
DECLARE cnt int
SET cnt = 1
I'm using MySQL.
I know this is really simple, but I've been suck on this for 2 hrs and I can't figure it out. I'm getting a syntax error when declaring a variable within an UPDATE statement. Here's how I'm declaring it:
DECLARE cnt int
SET cnt = 1
I'm using MySQL.
Is there an easy way to join more than 3 tables in MySQL without resorting to the nested Left join? I'm trying to join ~ 20 tables and the syntax I'm thinking about using is:
SELECT a.Col1, b.Col2, c.Col3, d.Col4
FROM Tbl1 AS a
LEFT JOIN Tbl2 AS b
ON a.Col1 = b.Col2
LEFT JOIN Tbl3 AS c
ON...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.