Re: A query that joins 2 tables

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



If you're not up to speed on SQL, I would suggest creating the individual
halves of the query in the Design Grid, and then copying the text from the
SQL view of each and pasting either side of the "UNION" operator. Make sure
you don't leave a semi-colon within the expression (Access usually creates
it at the end of the SQL statement). Also, only put one ORDER BY statement
at the end of the whole string, if it's required.

"Roger Carlson" <NO-Rog3erc-SPAM@xxxxxxxxxxx> wrote in message
news:ODh5olguFHA.3864@xxxxxxxxxxxxxxxxxxxxxxx
> It sounds to me like you want to use a UNION query:
>
> SELECT Company, Product, Reference, Price
> FROM Table1
> UNION
> SELECT Company, Product, Reference, Price
> FROM Table2
>
> There MUST be the same number of fields in the field list.
>
> --
> --Roger Carlson
> Access Database Samples: www.rogersaccesslibrary.com
> Want answers to your Access questions in your Email?
> Free subscription:
> http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
>
> "J. Silva" <JSilva@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:5CB96339-2995-4E82-87BB-3C5276EF04AE@xxxxxxxxxxxxxxxx
>> Hello
>>
>> I'm having some problem to make a query that joins 2 tables.
>>
>> The two tables (by kind of product) have some identical fields and others
>> that are different. the identical fields are: name of the company, the
> kind
>> of product, reference and the price. My aim is make a query that joined
>> in
> an
>> alone one these three fields for afterwards do the respective report,
> with
>> this headline: name of the company, kind of product, reference and price.
> Can
>> you help me?
>>
>
>


.



Relevant Pages

  • Re: Subquery with invalid column name runs
    ... Queries first try to reference the nearest column, ... Scoping rules in SQL are similar to the scoping rules in block ... But SQL is a bit more complicated. ... If two query expression are on the ...
    (comp.databases.ms-sqlserver)
  • RE: Problem with my Query
    ... this is the SQL for the simple query: ... And this is the SQL for the more complicated query: ... tblInvoiceLines.[Unit Price], tblTransactionRequest.InvoiceRequest, ...
    (microsoft.public.access.queries)
  • Re: Selecting Lowest Value from a Table
    ... Your answer was very helpful as with my limited experience with SQL was ... unaware that JOIN with a Sub Query Like that. ... the ManPartNum and Price Fields are repeated in the returned records. ...
    (microsoft.public.sqlserver.server)
  • Re: Help with computing dateTime between previous record
    ... I have the SQL query you sent working, now how do i adjust the end result? ... Bring all the required fields from the first reference in the grid. ... FROM tableName As a INNER JOIN tableName AS b ...
    (microsoft.public.access.queries)
  • Re: Query Help
    ... A good starting point for SQL is "SQL Queries for Mere Mortals" by Hernandez ... As for asking the user for the plate values, this query will ask the user ... (SELECT Avg(T.[Sale Price]) ... FROM TableName AS T ...
    (microsoft.public.access.queries)