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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:14:22+00:00 2026-06-18T11:14:22+00:00

I have a Sybase table with the following data (example): Users: ID Type PlayerID

  • 0

I have a Sybase table with the following data (example):

Users:

 ID        Type         PlayerID
 --------  -----------  ------------------- 
 65823     1            (null)              
 65823     2            187                 
 91817     1            (null)                         
 37950     1            773                 
 37950     1            (null)              
 37968     1            (null)              
 37968     1            773                                
 72576     1            (null)              
 72576     1            (null)                

I want to return all combination of the users and type’s but if there is more than one example of a particular user/type combination only show the record that isn’t null.

E.g. the above table should return the following

 ID        Type         PlayerID
 --------  -----------  ------------------- 
 65823     1            (null)           - although this is null the type/id is unique   
 65823     2            187              
 91817     1            (null)           - this is null but is a unique type/id              
 37950     1            773                                         
 37968     1            773              - this is included and the id/type that has a null player id isn't                              
 72576     1            (null)           - this is a unique type/id

So far I’ve looked into queries using group by, having and inner joins but have been unable to find a way to match the results I’m looking for.

I’ve also looked at things like group by, and then using max on the PlayerID, but aggregate functions ignore null values.

How can I return the unique id/type pairs with their player id?

—

Question from Paul:

ID        Type         PlayerID
 --------  -----------  ------------------- 
 65823     2            187                        
 37950     1            773                                         
 37968     1            773    
  • 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-18T11:14:23+00:00Added an answer on June 18, 2026 at 11:14 am

    From SQL side you can do like:

    select * from mytable t1 where playerId is not null
    union
    select * from mytable t2 where playerid is null 
       and not exists (
              select * from mytable t3 where t2.id=t2.id and t2.type=t3.type
           )
    

    I don’t know how effective it will be, but it will give you the result you want.

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

Sidebar

Related Questions

I have some tables on sybase-iq data base, created for example: create table tab
I have a table with the following columns and data: activity_dt | activity_amt 2009-01-01
We have an user table which the userId is an uniqueidentifier type in Sybase
I have a table with a column of data type bit . > CREATE
I have simple table in Sybase -- Creating table 'SimpleText' CREATE TABLE [dbo].[SimpleText] (
I have a simple table in Sybase, let's say it looks as follows: CREATE
I have a stored procedure'test' in Sybase ASA with for example 4 parameters. par1
I have a simple query over a table, which returns results like the following:
I'm working with a Sybase 12.5 server and I have a table defined as
I am using sybase. I have a table with columns named time and quantity.

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.