Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sku param字段 如果需要根据param字段里面的属性查询的话需要怎么实现? #5

Open
java668 opened this issue Nov 29, 2023 · 2 comments

Comments

@java668
Copy link

java668 commented Nov 29, 2023

image 如题:sku param字段 如果需要根据param字段里面的属性查询的话需要怎么实现?
@zq99299
Copy link
Owner

zq99299 commented Nov 29, 2023

mysql8 里面的 json 类型吗?

@zq99299
Copy link
Owner

zq99299 commented Nov 29, 2023

可以用这种方式

SELECT * FROM your_table
WHERE params->'$.CPU' = '骁龙855';

或者用这个语法

SELECT * FROM your_table
WHERE JSON_EXTRACT(params, '$.CPU') = '骁龙855';

这里是一些常用的 CRUD 操作,可以参考下:https://www.yuque.com/mrcode.cn/note-combat/eoasztz2k3di347m
更详细的就需要去参考官方文档了:https://dev.mysql.com/doc/refman/8.0/en/json.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants