By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
460,043 Members | 1,146 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 460,043 IT Pros & Developers. It's quick & easy.

Distinct values

P: 2
Hello Friends,

I have two tables like following

Table Name: Company
Company_Entry_ID Company
---------------------------- -------------
<CPY0000001> <Fusion>
<CPY0000002> <MTN>
<CPY0000003> <XPC>

Table Name: Support_Groups
Support_Organization Support_Group Company
------------------------------- --------------------- --------------
<InternalSupport> <ITSupport> <XPC>
<InternalSupport> <EmployeeSupport> <XPC>
<HelpDesk> <ITSupport> <Fusion
<InternalSupport> <CustomerSupport> <Fusion

Now I want the results like following in a separate view

Support_Organization Support_Group Company Company_Entry_ID
------------------------------ --------------------- ------------- ---------------------------
<InternalSupport > <ITSupport> <Fusion> <CPY0000001>
<InternalSupport> <EmployeeSupp> <XPC> <CPY0000003>
<InternalSupport> <CustomerSupp> <Fusion> <CPY0000003>
<HelpDesk> <ITSupport> <Fusion> <CPY0000001>

So in this case what should be the query...

I am asking this b'coz i never worked on Database like this...and frankly I don't know too much about database. I know only select, update, drop etc...

Plz help me, I'll be highly grateful to you people

Thanks in advance
Mar 4 '08 #1
Share this Question
Share on Google+
1 Reply


deepuv04
Expert 100+
P: 227
Hello Friends,

I have two tables like following

Table Name: Company
Company_Entry_ID Company
---------------------------- -------------
<CPY0000001> <Fusion>
<CPY0000002> <MTN>
<CPY0000003> <XPC>

Table Name: Support_Groups
Support_Organization Support_Group Company
------------------------------- --------------------- --------------
<InternalSupport> <ITSupport> <XPC>
<InternalSupport> <EmployeeSupport> <XPC>
<HelpDesk> <ITSupport> <Fusion
<InternalSupport> <CustomerSupport> <Fusion

Now I want the results like following in a separate view

Support_Organization Support_Group Company Company_Entry_ID
------------------------------ --------------------- ------------- ---------------------------
<InternalSupport > <ITSupport> <Fusion> <CPY0000001>
<InternalSupport> <EmployeeSupp> <XPC> <CPY0000003>
<InternalSupport> <CustomerSupp> <Fusion> <CPY0000003>
<HelpDesk> <ITSupport> <Fusion> <CPY0000001>

So in this case what should be the query...

I am asking this b'coz i never worked on Database like this...and frankly I don't know too much about database. I know only select, update, drop etc...

Plz help me, I'll be highly grateful to you people

Thanks in advance
Expand|Select|Wrap|Line Numbers
  1. SELECT s.Support_Organization,s. Support_Group,s. Company ,c.Company_Entry_ID
  2. FROM Support_Groups AS S INNER JOIN
  3.      Company AS C ON C.Company = s.Company
  4. order by  s.Support_Organization
  5.  
Mar 4 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.