Sir, SELECT statements aren't intended to work this way. Their 
purpose is to link rows from different tables that match on one or 
more columns. What you are trying to do is count unrelated rows that 
happen to have same value in the View column. There's a way to do it, 
but with 15 tables it involves 14 Cartesian products. Unless the 
tables are all very small, or unless you have massive amounts of RAM, 
I doubt that it is worth it.

Normally, you would do this by running 15 SELECT statements that 
count the rows with a specified value in the View column, and then 
formatting the results in your client. If the solution has to be all 
SQL, then you can insert the results of the queries into a temp 
table, and then query the table.

>Please help in the proper sql select statement for the following.
>
>I have 15 tables.  Each table includes
>a View column.
>
>I would like to return true values
>for the tables that have at least one row
>where View = "somevalue".
>
>For example, say I had only three tables, and
>table2 was the only one that had at least one
>row where View =  "somevalue", I would like to return
>a result set like so:
>
>--------------------------------
>| table1  | table2  |  table3  |
>--------------------------------
>|  0     |    1     |     0    |
>--------------------------------
>
>Basically I would like to perform this query
>so I will know which tables I can perform futher
>queries on.  The count of the rows in each table
>where view = "somevalue" is not really important,
>I just want to know which tables have at least one.
>
>On the otherhand, maybe a better approach would be to
>return one column ( thetablename ), containing the
>name of the tables that have at least one row
>where View =  "somevalue".
>
>Using my example above the result set would look like this:
>
>---------------
>| thetablename |
>----------------
>|  table2      |
>----------------
>
>Ether approach would yield the same data basically.
>How would I code the sql for either approach?
>
>Thanks so much in advance.
>
>Steve
>
>
>
>----------------------------------------------------------------
>Get your free email from AltaVista at http://altavista.iname.com
>
>---------------------------------------------------------------------
>Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
>To request this thread, e-mail <[EMAIL PROTECTED]>
>To unsubscribe, e-mail 
><[EMAIL PROTECTED]>
>Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Know thyself? Absurd direction!
Bubbles bear no introspection.     -Khushhal Khan Khatak

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to