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 7650955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:23:06+00:00 2026-05-31T11:23:06+00:00

I have a SQL squery, SELECT * FROM gr_person as GR INNER JOIN ADDRESS

  • 0

I have a SQL squery,

SELECT * FROM gr_person as GR
INNER JOIN ADDRESS ON GR.address_code = ADDRESS.address_code 
JOIN dbo.GR_PERSON_TYPES GPT
ON GR.person_type = GPT.person_type 
WHERE event_number = '101000008' 
ORDER BY GPT.type_key

That returns

GR.event_number, GR.person_type, GR.customer_code, GPT.type_key, GPT.event_type, GPT.person_type
101000008          Wife           10001             3             2                 Wife
101000008          Wife           10001             4             3                 Wife

I want this query to return only ONE ROW if the GR.PERSON_TYPE is SAME as in this case.

I tried adding a group by GR.PERSON_TYPE, but can’t help it.

Can somebody tell me how to do it?

  • 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-05-31T11:23:07+00:00Added an answer on May 31, 2026 at 11:23 am

    You can group by person_type to get one result for the group Wife, but you will need to aggregate or exclude your other columns.

    For instance, if you only want one record for Wife, what should the value for type_key and event_type be? If you want to see the maximum or average event_type for your Wife group, you could use max(event_type) or avg(event_type). The documentation for your DBMS should be able to explain all the aggregate functions for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have sql query select * from Roles Join Users On Roles.Role=Users.RoleId it return
I have sql server procedure, please see below. ALTER PROCEDURE [dbo].[uspInsertDelegate] ( @CourseID int,
I want to execute the following query using Subsonic: SELECT MAX([restore_date]) FROM [msdb].[dbo].[restorehistory] While
I have populated a datatable from a SQL stored procedure and need to do
Using SQL Server 2008, I have two stored procedures - create procedure [dbo].[SH_Export_data] (@unit
I have a datagrid to display some information from a SQL table, and then
I have sql database stored on a shared netwrok drive , after set of
I have SQL Server 2008 and VS 2008 Pro. And I am coding in
I have SQL Server 2008 with a table called ProductCategories designed like this: Id
I have SQL Ce db in my app, which is included in my app

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.