Ask the SQL Query 2 table questions:
A table is
ID Title Picid
Where Picid storage information is
A:4:{s:6: "Attach"; S:2: "S:9", "Show_type", s:1: "0"; S:9: "User_bind"; s:1: "1"; s:10: "Topic_bind"; s:0: "";}
Table B is
p_id purl
I first obtained the attach data in the Picid field by querying a table, and the output is in the form of an array of
aryy{
"0" 74
"1" 88
....
}
So how can I query the attach of table A to find the matching ID of B p_id 74 88?
Can you give me a code to explain?
Reply to discussion (solution)
Set the first step to get an array of
$ar = Array (74, 88);
Then there are
$sql = ' Select ' from table B where p_id in ('. Join (', ', $ar). ')';
If the order in which attach appears in Picid is fixed, you can also directly correlate two table queries
Like what
Select p_id, purl from table B, table A WHERE p_id = Substring_index (Substring_index (Picid, 4), ' "',-1)
Set the first step to get an array of
$ar = Array (74, 88);
Then there are
$sql = ' Select ' from table B where p_id in ('. Join (', ', $ar). ')';
If the order in which attach appears in Picid is fixed, you can also directly correlate two table queries
What if the order of occurrence is not fixed? Can I associate two table queries?
Use the LOCATE function first to locate, should also be possible