CREATE TABLE wpsc_posts (
ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
poST_AUTHOR BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
poST_DATE DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
poST_DATE_GMT DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
poST_CONTENT longTEXT COLLATE utf8mb4_unicode_ci NOT NULL,
poST_TITLE TEXT COLLATE utf8mb4_unicode_ci NOT NULL,
poST_EXCERPT TEXT COLLATE utf8mb4_unicode_ci NOT NULL,
poST_STATUS VARCHAR(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'publish',
comment_status VARCHAR(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'OPEN',
ping_status VARCHAR(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'OPEN',
poST_PASSWORD VARCHAR(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
poST_NAME VARCHAR(200) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
to_ping TEXT COLLATE utf8mb4_unicode_ci NOT NULL,
pinged TEXT COLLATE utf8mb4_unicode_ci NOT NULL,
poST_MODIFIED DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
poST_MODIFIED_GMT DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
poST_CONTENT_FILTERED longTEXT COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '00000000',
poST_PARENT BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
guid VARCHAR(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
menu_order INT(11) NOT NULL DEFAULT '0',
poST_TYPE VARCHAR(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'post',
poST_MIME_TYPE VARCHAR(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
comment_count BIGINT(20) NOT NULL DEFAULT '0',
PRIMARY KEY(ID),
KEY poST_NAME (poST_NAME (191)),
KEY type_status_date (poST_TYPE,poST_STATUS,poST_DATE,ID),
KEY poST_PARENT (poST_PARENT),
KEY poST_AUTHOR (poST_AUTHOR)
) ENGINE=InnoDB AUTO_INCREMENT=9100 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE wpsc_postmeta (
meta_id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
poST_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
meta_key VARCHAR(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
meta_value longTEXT COLLATE utf8mb4_unicode_ci,
PRIMARY KEY(meta_id),
KEY poST_ID (poST_ID),
KEY meta_KEY(meta_KEY(191))
) ENGINE=InnoDB AUTO_INCREMENT=74617 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
INSERT wpsc_posts (ID, poST_CONTENT, poST_TITLE, poST_EXCERPT, poST_STATUS, to_ping, pinged, poST_TYPE)
SELECT SEQ, RAND()*300 + 13, RAND()*13+SEQ, RAND()*300, 'publish', RAND()*300, RAND()*300, 'actORs' FROM seq_1_to_7500;
INSERT wpsc_posts (ID, poST_CONTENT, poST_TITLE, poST_EXCERPT, poST_STATUS, to_ping, pinged, poST_TYPE)
SELECT SEQ, RAND()*300 + 13, RAND()*13+SEQ, RAND()*300, 'publish', RAND()*300, RAND()*300, 'actORs' FROM seq_7501_to_15000;
INSERT wpsc_postmeta (poST_ID, meta_key, meta_value)
SELECT SEQ, 'gENDer', 'Female' FROM seq_1_to_10000;
INSERT wpsc_postmeta (poST_ID, meta_key, meta_value)
SELECT SEQ, 'gENDer', 'Male' FROM seq_10001_to_15000;
INSERT wpsc_postmeta (poST_ID, meta_key, meta_value)
SELECT SEQ, 'age', '28-30' FROM seq_1_to_2000;
INSERT wpsc_postmeta (poST_ID, meta_key, meta_value)
SELECT SEQ, 'age', '28' FROM seq_2001_to_3000;
INSERT wpsc_postmeta (poST_ID, meta_key, meta_value)
SELECT SEQ, 'age', '29' FROM seq_3001_to_4000;
INSERT wpsc_postmeta (poST_ID, meta_key, meta_value)
SELECT SEQ, 'age', '30' FROM seq_4001_to_5000;
INSERT wpsc_postmeta (poST_ID, meta_key, meta_value)
SELECT SEQ, 'age', '30' FROM seq_4000_to_5000;
INSERT wpsc_postmeta (poST_ID, meta_key, meta_value)
SELECT SEQ, 'actor_ethnicity', 'Maltese' FROM seq_1_to_10000;
INSERT wpsc_postmeta (poST_ID, meta_key, meta_value)
SELECT SEQ, 'complexion', 'Fair Freckles' FROM seq_1_to_10000;
INSERT wpsc_postmeta (poST_ID, meta_key, meta_value)
SELECT SEQ, 'NATURAL_accent', 'Maltese' FROM seq_1_to_10000;
INSERT wpsc_postmeta (poST_ID, meta_key, meta_value)
SELECT SEQ, 'actor_height', '60-70' FROM seq_1_to_10000;
INSERT wpsc_postmeta (poST_ID, meta_key, meta_value)
SELECT SEQ, 'chest', '813' FROM seq_1_to_10000;
INSERT wpsc_postmeta (poST_ID, meta_key, meta_value)
SELECT SEQ, 'waist', '6' FROM seq_1_to_10000;
INSERT wpsc_postmeta (poST_ID, meta_key, meta_value)
SELECT SEQ, 'hip', '191' FROM seq_1_to_10000;
INSERT wpsc_postmeta (poST_ID, meta_key, meta_value)
SELECT SEQ, 'eye_colour', 'Cyan' FROM seq_1_to_10000;
INSERT wpsc_postmeta (poST_ID, meta_key, meta_value)
SELECT SEQ, 'hair_colour', 'Pink' FROM seq_1_to_10000;
INSERT wpsc_postmeta (poST_ID, meta_key, meta_value)
SELECT SEQ, 'male_clothing_size', 'M' FROM seq_1_to_10000;
INSERT wpsc_postmeta (poST_ID, meta_key, meta_value)
SELECT SEQ, 'female_clothing_size', '88' FROM seq_1_to_10000;
SELECT wpsc_posts.* FROM wpsc_posts INNER JOIN wpsc_postmeta ON (wpsc_posts.ID=wpsc_postmeta.poST_ID) INNER JOIN wpsc_postmeta AS mt1 ON (wpsc_posts.ID=mt1.poST_ID) INNER JOIN wpsc_postmeta AS mt2 ON (wpsc_posts.ID=mt2.poST_ID) INNER JOIN wpsc_postmeta AS mt3 ON (wpsc_posts.ID=mt3.poST_ID) INNER JOIN wpsc_postmeta AS mt4 ON (wpsc_posts.ID=mt4.poST_ID) INNER JOIN wpsc_postmeta AS mt5 ON (wpsc_posts.ID=mt5.poST_ID) INNER JOIN wpsc_postmeta AS mt6 ON (wpsc_posts.ID=mt6.poST_ID) INNER JOIN wpsc_postmeta AS mt7 ON (wpsc_posts.ID=mt7.poST_ID) INNER JOIN wpsc_postmeta AS mt8 ON (wpsc_posts.ID=mt8.poST_ID) INNER JOIN wpsc_postmeta AS mt9 ON (wpsc_posts.ID=mt9.poST_ID) INNER JOIN wpsc_postmeta AS mt10 ON (wpsc_posts.ID=mt10.poST_ID) INNER JOIN wpsc_postmeta AS mt11 ON (wpsc_posts.ID=mt11.poST_ID) INNER JOIN wpsc_postmeta AS mt12 ON (wpsc_posts.ID=mt12.poST_ID) 
WHERE 1=1 AND ((wpsc_postmeta.meta_key='gENDer' AND wpsc_postmeta.meta_value='Female') AND (mt1.meta_key='age' AND mt1.meta_value='28-30') AND (mt2.meta_key='actor_ethnicity' AND mt2.meta_value='Maltese') AND (mt3.meta_key='complexion' AND mt3.meta_value='Fair Freckles') AND (mt4.meta_key='NATURAL_accent' AND mt4.meta_value='Maltese') AND (mt5.meta_key='actor_height' AND mt5.meta_value='66-70') AND (mt6.meta_key='chest' AND mt6.meta_value='813') AND (mt7.meta_key='waist' AND mt7.meta_value='6') AND (mt8.meta_key='hip' AND mt8.meta_value='191') AND (mt9.meta_key='eye_colour' AND mt9.meta_value='Cyan') AND (mt10.meta_key='hair_colour' AND mt10.meta_value='Pink') AND (mt11.meta_key='male_clothing_size' AND mt11.meta_value='M') AND (mt12.meta_key='female_clothing_size' AND mt12.meta_value='88')) AND wpsc_posts.poST_TYPE='actORs' AND ((wpsc_posts.poST_STATUS='publish'))
GROUP BY wpsc_posts.ID ORDER BY wpsc_posts.poST_DATE DESC;
