Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.ms-sqlserver > #1732

How could I add ProductName in this select query

From "Tony Johansson" <johansson.andersson@telia.com>
Newsgroups comp.databases.ms-sqlserver
Subject How could I add ProductName in this select query
Date 2014-03-15 17:05 +0100
Organization A noiseless patient Spider
Message-ID <lg1tp6$ldu$1@dont-email.me> (permalink)

Show all headers | View raw


I have this relation. The BookingDetails is a connection table because we 
have many to many between Booking and Products table
One Customers can have many bookings
Booking  (1)----------(m)BookingDetails 
(m)-----------------------(1)Products
   (m)
    |
    |
    |
  (1) Customers

The primary key in Products is ProductID
In this select clause I want to add in the result the ProductName that exist 
in the Product table.
How could I do that ?

Command.CommandText = "SELECT BokningFromDate, BokningToDate, Name, Address, 
Phone, ProductID, EnhetsPris " +
          "FROM Bokningar " +
          "INNER JOIN Customers " +
          "ON Bokningar.CustomerID = Customers.CustomerID " +
          "INNER JOIN BokningDetails " +
          "ON Bokningar.BokningarID = BokningDetails.BokningarID " +
          "ORDER BY Name asc";

//Tony 

Back to comp.databases.ms-sqlserver | Previous | NextNext in thread | Find similar


Thread

How could I add ProductName in this select query "Tony Johansson" <johansson.andersson@telia.com> - 2014-03-15 17:05 +0100
  Re: How could I add ProductName in this select query Erland Sommarskog <esquel@sommarskog.se> - 2014-03-15 17:30 +0100
    Re: How could I add ProductName in this select query "Tony Johansson" <johansson.andersson@telia.com> - 2014-03-15 17:50 +0100
      Re: How could I add ProductName in this select query "Tony Johansson" <johansson.andersson@telia.com> - 2014-03-15 18:09 +0100

csiph-web