Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 query help

Author  Topic 

anjali5
Posting Yak Master

121 Posts

Posted - 2010-08-17 : 13:03:28
I have four tables, I need to write the query that returns all widgets with a widget type code of “red” and also a query that return all widgets, , widget types and master widget types when the widget type is “blue.”. I need to return all values whether or not a widget naster type exists for each widget. Below is the schema for all the tables

tblWidget
WidgetID INT PK IDENTITY
WidgetTypeID SmallINT FK1
Code varchar (15) AK1
Name VarChar (30)
Description VarChar (250) NULL

tblWidgetType

WidgetTypeID INT PK IDENTITY
WidgetMasterTypeID TinyINT NULL
TypeCode VarChar (10) AK1
Name VarChar (30)
Description VarChar (250) NULL

tblWidgetMasterType
WidgetMasterTypeID TinyINT PK IDENTITY
TypeCode VarChar (10) AK1
Name VarChar (30)
Description VarChar (250) NULL

tblUser
UserID SmallInt PK IDENTITY
UserNumber SmallINT AK1
FirstName VarChar (50)
LastName VarChar (50)

tblWidgetUser
WidgetUserID Int PK Identity
WidgetID INT AK1 FK1
UserID INT AK1 FK2

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-08-17 : 13:07:10
is this a assignment question? can we see what you tried yet?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

slimt_slimt
Aged Yak Warrior

746 Posts

Posted - 2010-08-17 : 13:09:54
please provide some sample data and desired output
Go to Top of Page
   

- Advertisement -