SQL Server Performance

T-SQL Help???

Discussion in 'Getting Started' started by sivakumar.sundaresan, Aug 11, 2007.

  1. Hi,
    Can I have the T-SQL query for the following scenario.
    I have the following set of 3 tables with the values and the desired output is as below :
    create table cars (carid int, carname varchar(100)) ;
    create table Styles (Styleid int, Style varchar(100))
    create table carStyles (carid int, Styleid int)
    insert into cars values (1,'BMW');
    insert into cars values (2,'Volvo');
    insert into cars values (3,'Mercedes')
    insert into Styles values (0, 'Both');
    insert into Styles values (1, 'Sedan');
    insert into Styles values (2, 'Coupe')
    insert into carStyles values(1,0);
    insert into carStyles values(2,1);
    insert into carStyles values(2,2)
    insert into carStyles values(3,1)
    Desired output is as below:
    CarName Style
    ------- ------
    BMW SEDAN
    BMW COUPE
    Volvo COUPE
    Volvo SEDAN
    Mercedes SEDAN
    Many Thanks.
    -Siva
  2. ndinakar Member

    Please edit your post and format your code so its more readable.
  3. Hi Dinakar,
    I am really sorry for that. I have edited the same and I have reposted it.
    Please can I have the reply.
    -Siva
  4. satya Moderator

Share This Page