I have two tables: Table1 and Table2. Table1 has columns RECORDID, DATASOURCETYPE and STRINGCLOB, whereas Table2 has columns RECORDID, TIMESTAMP and CLICKTYPE. I have written a query to find the clob XML string ‘book’ from the STRINGCLOB column, provided that it matches a given DATASOURCETYPE, as follows:
SELECT SUBSTR(stringclob, instr(stringclob, 'type>')+5
, instr(stringclob,'</type')
- instr(stringclob, 'type>')-5
) r_type from Table1
where DataSourceType = 'Source1'
AND SUBSTR(stringclob, instr(stringclob,'type>')+5
, instr(stringclob, '</type')
- instr(stringclob, 'type>')-5
)
like '%book%'
Now, I would like to find and count all occurrences of ‘%book%’ string from the STRINGCLOB colum (Table1) that were recorded in the last month (something like AND TIMESTAMP > '01-Nov-12' AND TIMESTAMP < '01-Dec-12') and of CLICKTYPE <> 'Type1'. I am struggling with querying data from two distinct tables, any idea?
Thanks indeed,
I.
This is how you get the count of the record_type having value as
book.total
2
Now,if you want to join with the table 2,based on record_id