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.

Edited by ajoo
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.