我在数据库中有两张表,一张是 交易表:
id mac timestamp siteid
1 C8BCC8BD7684 1365987620 5
2 8C2DAA4CB9E6 1365995414 4
另一个是设备详细信息表:
id mac_address organization
1 00:00:0E Fujitsu limited
2 00:00:00 Xerox corporation
3 C8:BC:C8 Apple, inc.
4 8C:2D:AA: Apple, inc.
我需要加入这两个表。所以输出表应该是这样的,
id mac timestamp siteid organization
1 C8BCC8BD7684 1365987620 5 Apple, inc.
2 8C2DAA4CB9E6 1365995414 4 Apple, inc.
我可以使用 wordwrap(substr( transactions.mac
, 0, 6),2,":",true) 之类的东西从 transactions.mac 中检索前 6 个字母吗?我已经尝试了下面的代码,但是我得到了 mysql 错误:
"SELECT transactions.mac,equipment_details.mac_address,equipment_details.organization FROM `transactions`, `equipment_details` WHERE transactions.mac LIKE equipment_details.mac_address+'%' "
非常感谢任何帮助!