简体   繁体   中英

Mysql query help needed

I need to know if we can fetch id from a table given a value that is between another two values from another two different columns.

eg if value is 14 and i need id 21 from this table given two columns

Columns names : cpd_start
cpd_end.

Value = 14

id   ||     col          ||   value
-------------------------------------
21   || cpd_start        ||    10
21   ||  cpd_end         ||    20

Thanks

您可以使用数据表从您的表中获取整个数据,然后使用 foreach 循环获取每个值,当它达到您想要的值时,您也可以获得相应的 id。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM