Jump to content

MySQL search query


rohitbanerjee

Recommended Posts

Hello,

 

I can't really explain it so a example will be better:

 

my_table:

 

col1  col2  col3  col4

1      1      23    A

2      1      25    A

3      2      21    B

4      3      24    A

5      3      28    A

 

the query is--

SELECT col3 FROM my_table WHERE col2=SELECT(MAX(col2) FROM my_table WHERE col4='A')

 

For some reason this is illegal, I can also not use a limit because the number of rows is not known a priori. I remember seeing some sort of redirection in some other forum but would appreciate a more explicit response.

 

Thanks

 

This is not legal for some reason -- is there a way

Link to comment
https://forums.phpfreaks.com/topic/260942-mysql-search-query/
Share on other sites

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.