SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Display Supplier (Help)


Display Supplier (Help)

Author
Message
richesflow
richesflow
Forum Newbie
Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)

Group: General Forum Members
Points: 5 Visits: 5
I need to display the Name of all US-based, Japan-based and German-based suppliers. Order the results by Name in ascending order. Can you help me?
J Livingston SQL
J Livingston SQL
SSCertifiable
SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)

Group: General Forum Members
Points: 5440 Visits: 35369
richesflow (9/2/2012)
I need to display the Name of all US-based, Japan-based and German-based suppliers. Order the results by Name in ascending order. Can you help me?


Hello and welcome to the site.
for future reference you will find that for the majority of questions it is helpful to us and you if you can provide some example background details...this is often referred to as DDL / insert scripts......if you arent sure how to do this please post back.


below is some sample code that you can paste into SSMS and run.



USE [tempdb]
GO

-- create a table and insert some data to demonstrate what I am talking about
-- this will allow potential helpers to easily provide thoughts and solutions

IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Suppliers]') AND type in (N'U'))
DROP TABLE [dbo].[Suppliers]
GO


CREATE TABLE [dbo].[Suppliers](
[Supplier_ID] [int] IDENTITY(1,1) NOT NULL,
[Supplier_name] [varchar](50) NULL,
[Supplier_country] [varchar](50) NULL,
CONSTRAINT [PK_SUPPLIERS] PRIMARY KEY CLUSTERED
(
[Supplier_ID] ASC
)) ON [PRIMARY]

GO

SET IDENTITY_INSERT [dbo].[Suppliers] ON;

INSERT INTO [dbo].[Suppliers]([Supplier_ID], [Supplier_name], [Supplier_country])
SELECT 1, N'Acme Trade', N'Japan' UNION ALL
SELECT 2, N'Xyzzy Co', N'Germany' UNION ALL
SELECT 3, N'Zeus and Company', N'UK' UNION ALL
SELECT 4, N'Lincoln Inc', N'USA' UNION ALL
SELECT 5, N'Whamo Widgets', N'USA' UNION ALL
SELECT 6, N'MoCarCo', N'Germany'

SET IDENTITY_INSERT [dbo].[Suppliers] OFF;

-- here is some code that might provide some ideas.

SELECT Supplier_name, Supplier_country
FROM SUPPLIERS
WHERE (Supplier_country IN ('Germany', 'USA'))
ORDER BY Supplier_country, Supplier_name



________________________________________________________________
you can lead a user to data....but you cannot make them think
and remember....every day is a school day

Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (85K reputation)SSC Guru (85K reputation)SSC Guru (85K reputation)SSC Guru (85K reputation)SSC Guru (85K reputation)SSC Guru (85K reputation)SSC Guru (85K reputation)SSC Guru (85K reputation)

Group: General Forum Members
Points: 85682 Visits: 41086
richesflow (9/2/2012)
I need to display the Name of all US-based, Japan-based and German-based suppliers. Order the results by Name in ascending order. Can you help me?


Based on this and the other questions you've asked, I'd recommend taking a starter course on SQL. You can find such a thing at W3Schools.com.

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search