join - mysql - combining columns and tables -


I have a site where I have a database for all accounts and whatnot, and the tasks done by another user Site to archive

Each user has its own table, but I want to add data for each user group (all users who are "connected together") and the data that happened at that time. / P>

What I have here;

  & lt ;? Php $ query = "SELECT` TALKING_TO` from` nnn_instant_messaging` Where 'AUTHOR` =' '. The name displayed' 'and' TALKING_TO '! = '' "; $ Query = mysql_query ($ query, $ CON) or die (" _error_ ". Mysql_error ()); if (mysql_num_rows ($ query)! = 0) {$ table_str =" "; $ Select_ref_clause =" ( "; $ select_time_stamp_clause =" (while ($ row = mysql_fetch_array ($ query)) {$ table_str. = "` Actvbiz_networks`. "" $ row [ 'TALKING_TO']. "`, '; $ Select_ref_clause. = "` Actvbiz_networks`. "$ row [ 'TALKING_TO']." .REF`, '; $ select_time_stamp_clause. = "` Actvbiz_networks`. "" $ row [' TALKING_TO ']. "TIME_STAMP`,";} $ table_str = $ table_str . "` Actvbiz_networks`. "". DISPLAY_NAME "." $ Select_ref_clause = substr ($ select_ref_clause, 0, -2). ") as` Arif`, "; $ Select_time_stamp_clause = substr ($ select_time_stamp_clause, 0, -2 ).) As "TIME_STAMP`";} and {$ table_str = "` actvbiz_networks``` "appear. Ala name. "` "; $ Select_ref_clause =" `Arif`,"; $ Select_time_stamp_clause = "` TIME_STAMP` ";} $ Where_clause = $ select_ref_clause $ Select_time_stamp_clause; $ Query =" SELECT "$ Table_str from $ Where_clause" FROM ". "By order TIME_STAMP"; Die ($ query); $ Query = mysql_query ($ query, $ CON) or die ("_error_". Mysql_error ()); If (mysql_num_rows ($ query)! = 0) {} else {? & Gt; & Lt; P & gt; There are currently no actions in your network. & Lt; / P & gt; & Lt ;? Php}? & Gt;  

Returns the SQL statement in the code above:

  SELECT ( `actvbiz_networks` .john_doe.REF``,` actvbiz_networks`. 'Mmiline_ Jackson 'REF'), (`actvbiz_networks`. John_doe.TIME_STAMP``,` actvbiz_networks`. 'Emmilena_Jackson. TIME_STAMP`) `` actvbiz_networks` from AS` TIME_STAMP` .John_doe`, `actvbiz_networks`.'Emmalene_Jackson `,` Actvbiz_networks `by K_akt_veb_dijain` order TIME_STAMP  

I'm really learning on your feet with SQL.

Its not a problem with PHP (I quite happily remove code with PHP); It just helps in SQL statement.

Any help has been greatly appreciated.

Take time through your code, but with the question it seems as if you want a union.

  Selects a union as 2 in the form of a union as a selection  

 > A = 1 2 3 

Edit: So maybe something like that?

  DROP TEMPORARY TABLE If current T1; Degree temporary table if existing T2; Falling temporary table if currently TMP; Create a temporary table T1 (an INT (11)); Create temporary table T2 (BINT (11)); Insert T1 value (1), (2), (3); Insert T2 value (4), (5), (6); Select the temporary table TMP, select F from T2 order by F2 to T2 Union F as B; Select * TMP from  

returns

 f = 1 2 3 4 5 6 

Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -