Hi.
On Sun, Sep 09, 2001 at 04:44:24PM -0500, [EMAIL PROTECTED] wrote:
> Thanx ben. But I have found a way to do it :
>
> SELECT * FROM Asp, C, Cpp, Java, Javascript, etc... Where ....
You know, that this is not really the same? You (should) get each code
of each table paired with each code from each other table (for that
user, of course). That can be quite slow and you get a result multiple
times.
It doesn't work (I think), if no code for a user appears in one of the
tables. For this to work, you need to use LEFT JOINs, but then you
would still get too much results.
Maybe I misunderstand you database design here, assume you have
something like:
Asp:
User code someotherfields
Tom 1234
Paul abcd
Cpp
User code
Tom 2222
Tom 3333
Tom 4444
In this case
SELECT * FROM Asp, Cpp WHERE Asp.User='Tom' AND Cpp.User='Tom' gives back:
User code User code
Tom 1234 Tom 2222
Tom 1234 Tom 3333
Tom 1234 Tom 4444
and SELECT * FROM Asp, Cpp WHERE Asp.User='Paul' AND Cpp.User='Paul'
results in an empty set, because there is no row with Cpp.User='Paul'.
There, if it works for you, you obviously skipped some important
detail of your database design.
Usually, if the table all have the same structure, in relational
design they shouldn't have split at the first place, but the language
should be a flag in a column. But real life shows other needs
sometimes... if you need them split, you could use a MERGE table, as
said.
If they have a different structure, you may want to explain.
> If you know asp, write to me in private, I have something that (if you do
> know asp) you might be able to help me with.
Sorry, never had my hands on ASP.
Bye,
Benjamin.
> From: "Benjamin Pflugmann" <[EMAIL PROTECTED]>
> > Hi.
> >
> > It cannot be done with a SQL command, except if the structure of all
> > involved tables is the same. In this case, have a look for MERGE
> > tables.
> >
> > Else, you could create a temporary table and use
> >
> > INSERT INTO temp SELECT ...
> >
> > for all tables in question. Of course, you can simulate this in your
> > application, too.
> >
> > On Sat, Sep 08, 2001 at 09:09:42PM -0500, [EMAIL PROTECTED] wrote:
> > > How do I select all of the tables in a database and use a whre
> > > clause like this??::
> > >
> > > SELECT * FROM alltables(substitute with command) WHERE User =
> > > 'username' I need this for my site (Code Cafe- Free source code)
> > > so that the user can see all the code he has uploaded. It is
> > > done in ASP, but all I need is the sql query string. Thanx
---------------------------------------------------------------------
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