开发者

Get linked info from Mysql in one request

I gather info from my customer with a regular query:

select `ip`, `firstname`, `lastname` from `applications` where `pin` = '2232'

Is it possible to get also all the record that matches the customer ip in table from one pin numb开发者_JAVA百科er?

Example, one customer have one pin number, i make a request on this pin number and it returns me not only the info linked to this pin number but also the info from all other customer that used the same ip of the first customer.

Thank you for your help.


select ip, firstname, lastname from applications where pin = '2232' OR 
ip in (select ip from applications where pin = '2232')

Probably a way to do this without two selects, but this will work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜