简体   繁体   English

如何使用mysql中的where子句选择特定行?

[英]How to select the particular row using where clauses in mysql?

I have number of records in table. 我在表中有多个记录。 Assume that duration field has value of 70,180,280,380 and so on. 假设持续时间字段的值为70,180,280,380,依此类推。

Now i want to get the record of duration 100. It is between 70 and 180 so i want to get the details of 180 duration field values but it is not get the values from above 180. 现在我想获得持续时间100的记录。它介于70和180之间,所以我想获得180个持续时间字段值的详细信息,但它不是从180以上得到的值。

It is possible please help me. 有可能请帮帮我。

Thanks in advance. 提前致谢。

You can try this 你可以试试这个

SELECT T1.*, T2.*
FROM table T1 INNER JOIN table T2 on T2.duration - T1.duration >= 100
WHERE T2.ID = T1.ID + 1
ORDER BY T1.duration

Hoping it will solve your problem 希望它能解决你的问题

从你所说的:

SELECT * FROM `table` WHERE `duration`>70 AND `duration`<=180

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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