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 database like this:-
state_name|district_name|id
jammu |kupwara |jk-01
kashmir |anantnag |jk-02
I want a mysql Query such that when
statename is selected (jammu), distname should be selected(kupwara) based on thier id.
If any one knows please help me out.Thanks in Advance
If I understood your question properly, then query should be like this
SELECT state_name,district_name from TableName WHERE id='jk-01' //you can have your specific id here
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
so let's say I have 5000 rows, I want to select the rows from 2000 to 3000 only, how to do that via a SQL query?
Try this
select * from table limit 2000,1000
limit from,how-many
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
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
Improve this question
I want to save in aux this query
select id from principal_dep where dep_name='Field';
the user selects the field in a form. I have this which is obviously wrong
aux = Dep.objects.filter(id=request.POST['dept'])
how can I do this?, help!
dep = Dep.objects.get(dep_name=request.POST['dept'])
dep_id = dep.id
or
dep_ids = Dep.objects.filter(dep_name=request.POST['dept']).values_list('id', flat=True)
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
Could anybody let me know that how can i fetch unique(PKID, Column1,column2) values from my_table in mySql?
You can either use Ozzyberto's way, which should work, or you could use GROUP BY:
SELECT PKID,Column1,Column2
FROM my_table
GROUP BY PKID,Column1,Column2
sqlfiddle demo
You must be looking for the DISTINCT keyword:
http://www.w3schools.com/sql/sql_distinct.asp
You would need the following query:
SELECT DISTINCT PKID, Column1,column2 FROM my_table
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