SET等同于postgresql

SET等同于postgresql

本文介绍了mysql FIND_IN_SET等同于postgresql的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

select *
from folder f,uploads u
where u.id=f.folderId
and FIND_IN_SET('8', '15,9,13,27')

请告诉我相当于predefind或用户定义的postgresql函数

Please tell to me equivalent to predefind or userdefined postgresql function

推荐答案

您不应该首先存储逗号分隔的值,但是可以执行以下操作:

You shouldn't be storing comma separated values in the first place, but you can do something like this:

select *
from folder f
  join uploads u ON u.id = f.folderId
where '8' = ANY (string_to_array(some_column,','))

string_to_array() 根据传递的定界符将字符串转换为真实数组

string_to_array() converts a string into a real array based on the passed delimiter

这篇关于mysql FIND_IN_SET等同于postgresql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-26 08:12