dintinct query | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

dintinct query

i have a table which have the atributes city and cityid ..table shown below:- id city 1 surat 1 kota 2 kota 3 bhopal 5 bhopal 4 rajkot in the above table i want in the resultant output in this form that where the name of the city and id is same then the output will shown the distinct value

14th Sep 2016, 5:09 PM
Abhishek Dixit
Abhishek Dixit - avatar
1 Answer
0
I don't know if I get the question, but I will try ... >>>> a = {1 :"surat", 2:"kota",3:"kota",4:"bhopal",5:"bhopal",4:"raijkot"} >>>> for i in a; >>>> print(i,a[i]) 1 surat 2 kota 3 kota 4 raijkot 5 bhopal Well, I don't know if is this that you asked for. Dictonaries can't have the same keys (the two '1'), so there is something to adjust... if you explain me better what you need, I will try to help you.
14th Sep 2016, 6:03 PM
Giovanni Gatto
Giovanni Gatto - avatar