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

  • Home
  • SEARCH
  • 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 8528135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:44:08+00:00 2026-06-11T08:44:08+00:00

Well, I didn’t know how to explain this one on the title, so I’ll

  • 0

Well, I didn’t know how to explain this one on the title, so I’ll be clearer here.

I have a couple of tables:

TiposDeCatalogo:

PK IdTipoCatalogo (int) 
IdVendedor (int)
Nombre (string)
Descripcion (string)
Estado (string)
FechaAlta (date)

Catalogo: 

PK IdCatalogo (int) 
IdTipoCatalogo (int)
IdVendedor (int)
Nombre (string)
Descripcion (string)
Estado (string)
FechaAlta (date)

There is a foreign key on Catalogo.IdTipoCatalogo = TiposDeCatalogos.IdTipoCatalogo

I need a query that can show all rows on TiposDeCatalogo that have already been registered on Catalogo

For instance…

TiposDeCatalogos has the following rows

IdTipoCatalogo IdVendedor Nombre Estado FechaAlta

1   1   Catalogos de Ventas     Activo  20/08/2012
2   1   Catalogos de CRM        Activo  20/08/2012
3   1   Catalogos de Inventario     Activo  20/08/2012
4   1   Catalogos de Facturacion        Activo  04/09/2012
5   1   Catalogos de Cobranza       Activo  04/09/2012
6   1   Catalogos de Admin      Activo  04/09/2012
7   1   Catalogos de Admin      Activo  04/09/2012
8   1   Catalogos de Finanzas       Activo  04/09/2012
9   1   Catalogos de Clientes       Activo  04/09/2012
12  1   Catalogos de Administ General       Activo  04/09/2012

Then Catalogo has the following rows

IdCatalogo IdTipoCatalogo IdVendedor Nombre Estado FechaAlta

1   1   17  Formas de Pago  formas de pago para las ventas  Activo  01/09/2012
2   5   1   Tipos de Moneda     Activo  05/09/2012
3   2   1    Tipos de Agendamiento      Activo  05/09/2012
4   3   1   Tipos de Precios        Activo  06/09/2012
5   5   1    TIpos de Moneda        Activo  06/09/2012
6   3   1   Tipo de Presentacion        Activo  06/09/2012

You might notice that in Catalogo, only the following IdTipoCatalogo have been registered (1, 2, 3, 5)

So what I want, is a query that shows me those TiposDeCatalogos (only once each, so the query should only return 4 rows in this example)….

I hope you can help me, thanks

  • 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-11T08:44:09+00:00Added an answer on June 11, 2026 at 8:44 am

    You can use EXISTS to accomplish this:

    SELECT
        tc.IdTipoCatalogo,
        tc.IdVendedor,
        tc.Nombre,
        tc.Estado,
        tc.FechaAlta
    FROM TiposDeCatalogos tc
    WHERE EXISTS (
        SELECT 1
        FROM Catalogo c 
        WHERE c.IdTipoCatalogo = tc.IdTipoCatalogo 
    )
    

    Alternately, you could use a JOIN and DISTINCT:

    SELECT DISTINCT
        tc.IdTipoCatalogo,
        tc.IdVendedor,
        tc.Nombre,
        tc.Estado,
        tc.FechaAlta
    FROM 
        TiposDeCatalogos tc
        JOIN Catalogo c ON c.IdTipoCatalogo = tc.IdTipoCatalogo 
    

    However, this will likely be less efficient, because the DISTINCT will require the additional operation to exclude the duplicates produced by the JOIN.

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

Sidebar

Related Questions

Sorry if that title didn't explain it well. Here is the table... (source: alexanderdickson.com
Folks, I know I didn't phrase that title very well, but here's the scenario.
I have tried a couple of ways of doing this but didn't do well.
I'm sorry if I didn't explain my problem well enough in the title. In
I didn't know how to express this problem that well in word form so
I already asked this question, but I didn't explain it too well, so I
Well this is a really weird issue, I really didn't find anything on this
well i have a configuration like this in the components part of my config
I got this program that worked well 2 weeks ago, I didn't change any
I have a HTML table (well I didn't make it but I am using

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.