Jump to content

mysql temporary table result to identify rows in the table


ajoo

Recommended Posts

Hi all,

Does the statement

"CREATE TEMPORARY TABLE  temptab as  SELECT ... " 

provide some sort of a return value to check the null/number of rows in that table?

Running the same in phpadmin definitely gives the number of rows affected but i don't know how to tap into that value. I tried using the

$stmt->bind_result($count); 

after executing the query thinking it might be the same as the Select query but that returns no value while my table has about 7 rows generated.

If someone can show how, if the value can be retrieved.

Thanks.

 

Link to comment
Share on other sites

SIr,

The following query however fails to give the number of affected rows.

SELECT 
table_A.uid,
table_A.pole,
table_A.act as Status
FROM
table_A

UNION

SELECT
table_B.uid,
table_B.pole,
table_B.confirm_A as status
FROM table_B

UNION

SELECT
table_C.uid,
'User' as pole,
(table_C.confirm_A + table_C.confirm_B) as status
FROM table_C;

There are about 9 rows that are actually formed so I wonder if that is the same as rows affected. Is there a way to find the number of rows formed from the above query ?

Presently I encompass the above query with an additional

SELECT COUNT(uid) FROM
{




}bb;

which provides the rows that are available as 9.

Running the 1st query is faster in this case. I was wondering if I could do without the COUNT(uid) thingy !

Thank you.

 

Link to comment
Share on other sites

Hi Benanamen !

Thanks for the response. Please bear with me for a day or so while I am doing a quick run through of my code. I'll come back and revert shortly.

Meanwhile, here's a link, in case you would like to check out the near same discussion earlier on this topic.

https://forums.phpfreaks.com/topic/301981-query-woes-confused/

Sorry for this delay.

Thanks.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.