Jump to content

search for equal values in one column


asmith

Recommended Posts

can i search a column to see if at least 2 values are the same in 2 different rows ?

i need to choose one value from a  table  IF  no other row has the same values .

 

example :

 

table :

 

id  int1  int2    int3    int4

1    56    24      36      48

2    14    34      23      29

3    56    24      34      44

4    34    26      76      23

 

 

i want to select id ,  where int1 is the max . if it found 2 or more rows with the same max number, then select id from this 2 or more where int2 is the max , if int2 were the same .... goto int3  ..... int 4 .      if the last int were the same too , select nothing .

 

can i do that ?

 

Link to comment
https://forums.phpfreaks.com/topic/82472-search-for-equal-values-in-one-column/
Share on other sites

ok , if that is not possible , how can i search it a row where a column is max in it ? i searched for an hour but didn't find what i want .

 

something like :

 

select id from table where int1 is maximum

 

it seems i can't get a right syntax for it ,

how can i achieve this ?

Weeeeelll.....I thought you were going to download that reference manual and see some examples

 

Select id, MAX(int1)  FROM table_name GROUP BY id;

 

But better you download that manual and start studying so you don't have to wait for simple questions ...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.