代码点火器 SQL
有人可以帮我转换这个 mysql 查询,将其转换为 CodeIgniter SQL 方法,
$sql = "SELECT MAX( SUBSTRING( locationID , 3, 11 ) )
FROM items WHERE LEFT( locationID , 2 ) = = ? "
具有位置 ID 等值,例如 AK23、LI343、JE343 等。它返回与前缀匹配的最高整数(JE、LI - 给定 2 个字符前缀在where子句中)
如果你能帮我解决这个问题那就太好了,因为在模型中编写sql的正常方法不起作用..
非常感谢
can someone please help me to convert this mysql query to convert it to CodeIgniter SQL method
$sql = "SELECT MAX( SUBSTRING( locationID , 3, 11 ) )
FROM items WHERE LEFT( locationID , 2 ) = = ? "
Having values such as location id's such as AK23, LI343, JE343 etc.. it returns the highest integer matching the prefix(JE, LI - given 2 character prefix in the where clause)
It will be great if you can please help me with this as the normal way of wriring sql in the model does not work..
Thanks alot
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
db->query('SELECT MAX( SUBSTRING( locationID , 3, 11 ) )
FROM items WHERE LEFT( locationID , 2 ) = ?', array(args)
db->select('MAX(SUBSTRING( locationID , 3, 11))')->from('items')->where ('LEFT( locationID , 2)', arg)->get()
希望有帮助
db->query('SELECT MAX( SUBSTRING( locationID , 3, 11 ) )
FROM items WHERE LEFT( locationID , 2 ) = ?', array(args)
db->select('MAX(SUBSTRING( locationID , 3, 11))')->from('items')->where('LEFT( locationID , 2)', arg)->get()
hope that help