I am working backwards with a query. I have a select query that fetches some rows...but now I am working backwards and want to insert entries in concerned tables to that the select query brings back the stuff I inserted.
Select Query:
SELECT DISTINCT a.catalogID, a.topicID, a.topicShortName
FROM catalog_lu_topics a
LEFT JOIN catalog b ON a.catalogID = b.catalogID
LEFT JOIN catalog_topics d ON ( a.topicID = d.topicID
AND d.topicID != 'top295' )
LEFT JOIN catalog_topics e ON ( (
d.catalogID = e.catalogID
)
AND (
e.topicID != d.topicID
) )
LEFT JOIN catalog_lu_topics f ON f.topicID = e.topicID
WHERE a.displayStatus != 'hide'
AND f.parentID = 'top305'
I've inserted entries in the following tables:
catalog
catalog_lu_topics (made sure that parentID = 'top305')
catalog_topics (made sure topicid is not top295)
catalog_topics (additional entry, with different topicID)
After the insert statements if I run the above query again, i do not see the new entries. But If I remove the following entries from the above select query then I see the new entries:
AND (
e.topicID != d.topicID
)
I cant wrap my head around this and need some advice.
EDIT: result of select a.* e.topicid, d.topicid (after adding new entries). Note new entries do not show up in this resultset
top335 114 Victorian Grace top301 5 gvl107 Desc display 2007-03-26 12:38:46 top318 top335
top329 34 Revived Georgian top301 2 gvl107 Desc display 2007-03-26 12:38:46 top318 top329
top338 117 DC Townhouse top301 4 gvl107 Desc display 2007-03-26 12:38:47 top318 top338
top329 34 Revived Georgian top301 2 gvl107 Desc display 2007-03-26 12:38:46 top316 top329
top336 115 Bespoke in Bethesda top301 6 gvl107 Desc display 2007-03-26 12:38:46 top316 top336