Count Unique Values with Diffrent Values

ootkhopdi

Registered User.
Local time
Tomorrow, 00:05
Joined
Oct 17, 2013
Messages
181
Hello

i have one table in which ID is Primary ID with Different Values
Like

ID NAME PAN
1 A X
1 B Y
1 A X
2 C Z
2 C G
3 D U

it shows that ID 1 having 2 Name (A& B,with PAN, X & Y ,respectively)
how can i get this that ID having More than 1 Value
like 1
and how can i select only these records ID which having more than 1 value
and how can i update values for 1 ID
pls help me
 
Last edited:
hi,
you can use query as below:

ID having More than 1 Value:
SELECT ID, COUNT(*)
FROM table_name
GROUP BY ID
HAVING COUNT(*) > 1

update values for 1 ID:
update table_name set id=TheValueYouWant
where id=1
 
You may wish to research PrimaryKey. Every table should have a PrimaryKey which uniquely identifies records in the table.
 
hi,
you can use query as below:

ID having More than 1 Value:
SELECT ID, COUNT(*)
FROM table_name
GROUP BY ID
HAVING COUNT(*) > 1

update values for 1 ID:
update table_name set id=TheValueYouWant
where id=1

Thanks ...
But i think i cant explaine my update query

i want to update values respectively ID=1,,not for inplace of ID,,
like where id=1, name is A,
 
Please show us exactly what the output should be.
 
i want of get output of table like this
ID NAME PAN
1 A X
1 A X
1 A X
2 C Z
2 C Z
3 D U

can i do it in one time command or create query
 
first you define master table..which is the correct data
secondly, create the update query

pls find attached.
 

Attachments

i want to run update query with a forms value
like Creteria, Update value and field(in combo box value)
but when it run query it show a messege box when i fill it it say field in not updateble

what is the problem ..
 
i think you have to check the relationship.

if you upload your database, others could help you.
(now it's time to log out.^^)
 

Users who are viewing this thread

Back
Top Bottom