Solved

DB Design Search data

Posted on 2009-06-28
5
165 Views
Last Modified: 2013-12-25
I have vb.net customer database. there is some client sell many brand like HP,IBM,NEC and etc.
shoud i store all those brand into 1 column like HP,IBM,NEC
or
use diffrence column for 1 brand.

i need to search let say HP. so all those client who sell HP will show up from the dataset.
0
Comment
Question by:aarontham
  • 2
  • 2
5 Comments
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 24733612
You can store the brandIs in a different table and store their curresponding ids in the Client table

Table  Brands (BrandID int identity, BrandName varchar(120)  )
Table  ClientInfo (ClientId int, BrandID int )
0
 

Author Comment

by:aarontham
ID: 24733757
If let say i have a client sell few brand then how to store?
0
 
LVL 48

Expert Comment

by:jpaulino
ID: 24734022
You should create a new table with the customer ID and the brand. Then you make a inner join to get all the brands for each customer.
0
 

Author Comment

by:aarontham
ID: 24734466
Hi jpaulino,

can i have saome sample how this sample look like.
0
 
LVL 48

Accepted Solution

by:
jpaulino earned 500 total points
ID: 24734518
Three tables ....
Customers (CustomerId, customersName, etc)
Brands (BrandId and BrandName)
CustomerBrands (customerID  and BrandId)
In the Brands table you will have all the brands available and in the CustomerBrands you have a list of all customers and the brands they have. Then you can use a INNER JOIN view to show all

SELECT Customers.name, Brands.BrandName, Customers.customerID
FROM   Customers INNER JOIN
       CustomerBrands ON Customers.customerID = CustomerBrands.customerID INNER JOIN
       Brands ON CustomerBrands.BrandId = Brands.BrandID

Open in new window

0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question