Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7953755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:13:52+00:00 2026-06-04T03:13:52+00:00

Customers id,name,orderid ———————- 1,Ted, 1 2,Jen, 2 Orders id,prodname ———————- 1,widgetA 1,widgetC 2,widgetB 2,widgetA

  • 0
Customers
id,name,orderid
----------------------
1,Ted, 1
2,Jen, 2

Orders
id,prodname
----------------------
1,widgetA
1,widgetC
2,widgetB
2,widgetA


desired results
name, prodname
----------------------
Ted, widgetA
' ', widgetC
Jen, widgetB
' ', widgetA

Basically I don’t want to repeat the customer’s name if she has more than one product. Is there a way to do this?

Solution:

Select 
    (CASE WHEN myrow=1 THEN Name ELSE ' ' END) AS Name,
    product
From
(
    Select 
        ROW_NUMBER() OVER (PARTITION BY c.Name ORDER BY c.Name) AS myrow,     
        o.productname AS product 
    FROM 
        Customers c JOIN 
        Orders o ON c.orderid = o.id 
) T1

Order By Name
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T03:13:52+00:00Added an answer on June 4, 2026 at 3:13 am

    To answer your question, though there is a strong case to use a different solution; If you are using sql server take a look at “row_number()”. I don’t use SQL Server, but it might look something like this:

    Select
        ROW_NUMBER() OVER (ORDER BY c.Name) AS myrow,
        if(myrow=1,name,' ') AS name,
        o.productname AS product
    FROM
        Customers c JOIN
        Orders o ON c.orderid = o.id
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to do a find which orders results by their house name
I have 5 tables: customers id - name p_orders id - id_customer - code
Customers Holidays id | name customer_id | start | end ---+------ ------------+--------+------ 1 |
var expr = Data.Customers .GroupBy(c => c.Country, c => c.Name); foreach (IGrouping<Countries, string> customerGroup
IList<Customer> Customers = flat.GroupBy(cust => new { cust.ReferenceNumber, cust.Name, cust.Address }) .Select(c => new
This is the DB Schema: Books (bookid, title, author, year) Customers (customerid, name, email)
$qb = $this->createQueryBuilder('t'); return $qb ->join('t.customers', 'c') ->where($qb->expr()->eq('t.user', $user->getId())) ->andWhere($qb->expr()->gt($qb->expr()->count('c'), 0)) ->orderBy('t.name')->getQuery()->getResult(); The above
i have one xml like, Declare @xmldata xml; set @xmldata =' <Customers> <Id>1</Id> <Name>foo</Name>
I have two tables Orders table and customers table, both have customerid as common
imagine a database setup, where x customers can make y orders. normally all customers

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.