SQL Server Programming

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • two tables select fields

    2 answers - 434 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    Suppose I have two tables A and B
    Table A has fields A1, A2, A3, ... A9
    Table B has fields B1, B2, B3, ... B9
    I want to select all fields in A and only B3 in table B. I dont want to
    list individual fields for A because they are too many I simply want to
    use a *.
    How do I do this?
    I tried this way but they are not working
    Select * from A1, B3 from B
    Select *, B3 from A, B
    Thanks
    John
  • No.1 | | 71 bytes | |

    Ok I have figured out how to do it
    its
    select A.*, B.B3 from A, B
  • No.2 | | 518 bytes | |

    Your query will yeild the desired column list but probably not the desired
    results, unless you want a Cartesian product. I suspect you want to join
    the tables:

    SELECT A.*, B.B3
    FROM A
    JOIN B ON A1 = B1
    Hope this helps.

    Dan Guzman
    SQL Server MVP

    <jkmambo@gmail.com> wrote in message
    news:1127598599.423793.238970@g49g2000cwa.googlegroups.com...
    > Ok I have figured out how to do it
    > its
    > select A.*, B.B3 from A, B
    >

Re: two tables select fields


max 4000 letters.
Your nickname that display:
In order to stop the spam: 5 + 4 =
QUESTION ON "SQL Server Programming"

PERL.THATSCRIPTS.COM