dongwu9063 2015-03-21 21:13
浏览 30

使用mysql检查数组中的重复项

I have a column in my table that will always contain an array of three items (they come from 3 selects with the same items that the user chooses from). I need to make a query that will return if any user has selected the same combination of 3 items that another user has selected too, doesn't matter the order he chose them in.

So I have 3 selects with the same content in them, the user needs to chose an item from each one (it's validated so all of them are different) and I need to check if that combination has been chosen before or not.

In my database the array looks like this:

a:4:{i:0;s:8:"item1";i:1;s:8:"item3";i:2;s:8:"item5"}

The database will have many users so I'm afraid that checking this will be very resource intensive, what is the best way to approach it?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 孟德尔随机化结果不一致
    • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
    • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
    • ¥15 谁有desed数据集呀
    • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
    • ¥15 关于#hadoop#的问题
    • ¥15 (标签-Python|关键词-socket)
    • ¥15 keil里为什么main.c定义的函数在it.c调用不了
    • ¥50 切换TabTip键盘的输入法
    • ¥15 可否在不同线程中调用封装数据库操作的类