Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
For a MOD that I am attempting to write for phpBB, I need to know how to find a value in a row of a MySQL database table based off of another row in the table. For example, say that this is my table.
Row_Id | Name | Birthday
————————————————————————
1 | Bob | 1/19/1965
2 | Ann | 9/15/1968
How could I find the person’s name based off of the row ID? I haven't been able to figure it out, and Googling around warranted no results. I need the data that I get to be echoed using PHP, but I already understand how to do that.
Here you go
SELECT * FROM tbl WHERE Row_Id = $id
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I am trying this . I have a table in mysql named "quotes" with columns (id,quote,author) with around 100 rows.
i want to select one quote daily and next day another quote sequentially .
how do i achieve this task. I want to get and display it in my webpage daily one quote.
If your id column is sequential (i.e. no gaps) from x to y, you could use modular arithmetic:
SELECT * FROM quotes WHERE id = x + TO_DAYS(CURRENT_DATE) % (y - x + 1)
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Lets say I have the table as follows
Name Firm Salary
Aron X 100
Bill X 200
Clint Y 300
I want to find the firm with maximum number of employees and produce the result
Firm Total
X 2
However here is my problem, The following query never works in MySQL
select firm,max(Number_Of_Employees) as Total from
(select firm,count(*) as Number_Of_Employees from works group by firm)
as temp;
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
How can I simulate that my MySQL field is an array, and later with some query to search element in that array ?
In only MySql:
To get the field.
select FIELDNAME from TABLE
To search from that result set:
select FIELDNAME from TABLE where FIELDNAME like '%myvalue%'
The %'s are wild cards. This would return any value with myvalue in it.
Such as:
(amyvalue, bmyvalueb, I<3myvaluecompletely)
If you want this done in some language you need to provide a more verbose and detailed question.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I've got a large database table and wanting to select rows in the column 'cat_id' containing the value "79", then replace all the values in a column called "system" with the value "6" for the selected rows.
This query will do that:
UPDATE `table` SET `system` = '6' WHERE `cat_id` = '79'
I could be misunderstanding you, but i think you are looking for a simple update:
UPDATE yourTable
SET system = 6
WHERE cat_id = 79;
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have a table that contains a column price with 3600 entries. I need to increase the price column by 9% or multiply the contents of the column price by 1.09 and place the updated price back in the price column. What is the best way to approach this?
Should be pretty straightforward:
Update MyTable Set Price = Price*1.09