Hi,

I am using mysql 5.0.77.

I am running queries like

create table T1 as Select t1.arg0 as ARG0, t1.arg1 as ARG1, t2.arg0 as ARG3 from table t1, table t2 where t1.arg0=t2.arg0

I want to create the table if the select statement does not return an empty resultset.

If I first run the select statement and get number of rows returned and if it is greater than 0 run the

create table T1 as Select t1.arg0 as ARG0, t1.arg1 as ARG1, t2.arg0 as ARG3 from table t1, table t2 where t1.arg0=t2.arg0

statement, will select result be retrieved from the query cache or will it be re-executed?

I am using mysql C api and it has a function to return number of retrieved for a query.

Or any other suggestions?

thanks

It will come from cache if the data in the table did not get changed between your select and create as select statements.

To ensure that the number of records are >0 use
select count (*) not select *

Thank you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.