company_name | macid | expiry_date
---------------------------------------------
abc | 123456789012 | 2017-03-23
qwe |12 | 2018-05-24
asd | 456789123012 | 2019-07-07
abc | 789456123000 | 2017-03-23
abc | 445544444444 | 2018-03-03
abc | 555555555555 | 2017-03-25
company_name | desktop | server
abc 123456789012 555555555555
789456123000
我有上面的两个表,我想所有macid和expiry date是存在于table1和table2。此外,我已将所有macid作为新行和桌面macid和服务器macid存储在不同的列中。我的查询mysql查询加入两个表格like
"select a.macid,a.expity_date from table1 a,table2 b where a.macid like b.desktop or a.macid like %'b.server%'"
但显示结果为空。请帮忙解决。
我想导致
macid | expiry_date
---------------------------------------------
123456789012 | 2017-03-23
789456123000 | 2017-03-23
555555555555 | 2017-03-25
为表2,如果我要搜索MAC_ID他们,我必须使用
"select * from table2 where desktop like '%123456789012%'"
而不%我不能检索记录(百分比)
我提到我的所有数据都是以新行的形式存储的。所以我必须用%% – LOKESH
@LOKESH来查询,然后用'like' :) – Blank