Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

SqL lookup table basics

Avatar of harveygs
harveygs asked on
DatabasesMicrosoft SQL ServerSQL
8 Comments1 Solution2422 ViewsLast Modified:
I have 400 computers that can have between 1 to 4 printers allocated. From a list of 20 printers. And also another column showing which one of those 4 is the default printer. This is queried in a VBS logon script.
I just need the table layout and SQL query not any vbs sript.
Being new to sql I dont know the best way to make the tables. I assume I would need 2 with a join.
first table 'Printer_List'
pr_id  name
1     epson99
2     hpthingy22
3     konicaxyz

2nd table PC_List
pc_name    pr1    pr2   pr3  pr4    default_printer                  where default would be = 1 to 4
room1       1          0     0     0        1
class77     3         2     0       0      2
pc99          4        0     0     0         4

a zero means no printer allocated
so for instance the pc called class77  has two printers allocated, konicaxyz and hpthingy22
and the hpthingy22 is to be the default printer.
eventually 6 variables
pr3=0 or null
pr4=0 or null
I hope that makes sense .

Avatar of TextReport
TextReportFlag of United Kingdom of Great Britain and Northern Ireland image

Our community of experts have been thoroughly vetted for their expertise and industry experience.

This problem has been solved!
Unlock 1 Answer and 8 Comments.
See Answers