Ladies and gentlemen, it is always wrong for me to find an SQL statement by myself and there are repeated items in the result. Please help me check it out. Thank you. Three tables: content, relationship, meta, content is content, primary key cid, meta table Storage Class name, type, etc., primary key mid; re... ladies and gentlemen, it is always wrong for me to find an SQL statement by myself and there are repeated items in the result. Please help me check it out. Thank you.
Three tables: content, relationship, meta,
Content is content, primary key cid;
The name and type of the meta table Storage category. The primary key is mid;
Relationship is the relationship between content and meta. There are two keys: cid and the corresponding mid.
An SQL statement is to give a category name, for example, default, to find the relevant content and meta content into an array.
PS. It's a bit like the database structure in Wordpress. I haven't found out how WP is implemented after a long time ...... Weak
I tried to write a few articles, but they are not correct. JOIN is not good. Please help me. Thank you.
Reply content:
Ladies and gentlemen, it is always wrong for me to find an SQL statement by myself and there are repeated items in the result. Please help me check it out. Thank you.
Three tables: content, relationship, meta,
Content is content, primary key cid;
The name and type of the meta table Storage category. The primary key is mid;
Relationship is the relationship between content and meta. There are two keys: cid and the corresponding mid.
An SQL statement is to give a category name, for example, default, to find the relevant content and meta content into an array.
PS. It's a bit like the database structure in Wordpress. I haven't found out how WP is implemented after a long time ...... Weak
I tried to write a few articles, but they are not correct. JOIN is not good. Please help me. Thank you.
Done.
SELECT * FROM hycms_metas AS mRIGHT JOIN hycms_relationships AS r ON m.mid = r.midJOIN hycms_contents AS c ON r.cid = c.cidWHERE m.slug = 'default'AND m.mid IS NOT NULL