Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: Re: Union all.. I got some troubles-


Message #1 by "Ken Schaefer" <ken@a...> on Thu, 2 Jan 2003 13:14:37 +1100
You can't "get" the underlying table as such. SQL doesn't work that way.
Instead you create a set of results that match your criteria. This may,
conveniently, be the entire contents of a given table. Or it might be the
intersection of two tables, or the union of two tables. Whatever the
resultset is, that's all you've got...

You could do something like this:

SELECT
    a.Field1,
    a.Field2,
    a.Field3,
    "Table1"
FROM
    Table1 AS a
UNION
SELECT
    b.Field1,
    b.Field2,
    b.Field3,
    "Table2"
FROM
    TAble2 AS b

and retrieve the table name through objRS.Fields(3).Value

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "salpe" <salpe99@l...>
Subject: [access_asp] Re: Union all.. I got some troubles-


: Hi again..
: Can someone just suggest me a place a book or whatever where I can
: straighten out that problem?
: Thank you.
:
:
: At 19:53 28-12-2002 +0100, you wrote:
: >Hi everybody, and Merry Xmas.
: >I've got a problem building up a search engine for a forum.
: >It actually queries the db (a MsAccess Db) (where all the tables of all
: >forums are contained in), making several SQL strings merged up through an
: >"Union All" command.
: >
: >The querying process works pretty good, and it doesn't affect too much
: >resources (it seems so.., and I need to keep this point low), but when I
: >gonna print out the results of the query I do need to know the name (or
: >the cardinal number) of the table the current result is coming from, in
: >order to make the link to the showing-message-page.
: >
: >In other words what I would like to know is how to call a "method" like
: >the following one:
: >
: >(considering "rs" being a record-set object, --after a query--)
: >
: >rs.get-current-table-name()
: >
: >But actually I haven't found anything like that after two weeks of search
: >on google and in other places and books.
: >
: >Please help me, if you can.
: >
: >Thank you
: >/salpe


  Return to Index