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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:02:07+00:00 2026-05-18T00:02:07+00:00

I need help. I have a sql table t2 related to two other tables

  • 0

I need help.

I have a sql table t2 related to two other tables t1 and t3.

t2 has fields:

idFromt3 idFromt1 Value

1        14        text1
2        14        text2
1        44        text1
2        44        text2
3        44        text3

I’m searching for values, where ifFromt3 is missing.
I want to fint in this example, the value ifFromt3 = 3, because of it’s not present.

I’m doing it like this example, but it doesn’t work correctly.

SELECT t3.idFromt3, t3.idFromt1
FROM t3 
  INNER JOIN t2 
    ON t3.LanguageMessageCodeID <> t2.idFromt2

This are the 3 tables.

CREATE TABLE [dbo].[t3](
    [t3ID] [int] IDENTITY(1,1) NOT NULL,
    [Name] [varchar](50) NOT NULL,
)

CREATE TABLE [dbo].[t2](
    [t2ID] [int] IDENTITY(1,1) NOT NULL,
    [t3ID] [int] NOT NULL,
    [t1ID] [int] NOT NULL,
)


CREATE TABLE [dbo].[t1](
    [t1ID] [int] IDENTITY(1,1) NOT NULL,
    [Name] [varchar](50) NOT NULL,
)

UPDATE:

Tables with data:
http://www.2shared.com/photo/40yY6FC-/Untitled.html

And I need a query, that returns all missing combinations in table LangugageMessageCodes.

In this case:

LanguageMessageCodeID  LanguageID
3                      14
1                      47
2                      47
3                      47

please. help.

regards.

  • 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-18T00:02:08+00:00Added an answer on May 18, 2026 at 12:02 am
    SELECT  *
    FROM    t2
    WHERE   t2.idFromt3 NOT IN
            (
            SELECT  LanguageMessageCodeID
            FROM    t3
            )
    

    or

    SELECT  *
    FROM    t2
    WHERE   NOT EXISTS
            (
            SELECT  NULL
            FROM    t3
            WHERE   t3.LanguageMessageCodeID = t2.id
            )
    

    or

    SELECT  t2.*
    FROM    t2
    LEFT JOIN
            t3
    ON      t3.LanguageMessageCodeID = t2.id
    WHERE   t3.LanguageMessageCodeID IS NULL
    

    Update:

    Try this:

    SET NOCOUNT ON
    DECLARE @t1 TABLE (id INT NOT NULL PRIMARY KEY)
    DECLARE @t2 TABLE (t3id INT NOT NULL, t1id INT NOT NULL, PRIMARY KEY (t1id, t3id))
    DECLARE @t3 TABLE (id INT NOT NULL)
    
    INSERT
    INTO    @t1
    VALUES  (14)
    INSERT
    INTO    @t1
    VALUES  (44)
    
    INSERT
    INTO    @t2
    VALUES  (1, 14)
    INSERT
    INTO    @t2
    VALUES  (2, 14)
    INSERT
    INTO    @t2
    VALUES  (1, 44)
    INSERT
    INTO    @t2
    VALUES  (2, 44)
    INSERT
    INTO    @t2
    VALUES  (3, 44)
    
    INSERT
    INTO    @t3
    VALUES  (1)
    INSERT
    INTO    @t3
    VALUES  (2)
    INSERT
    INTO    @t3
    VALUES  (3)
    
    SELECT  t1.id, t3.id
    FROM    @t1 t1
    CROSS JOIN
            @t3 t3
    WHERE   NOT EXISTS
            (
            SELECT  NULL
            FROM    @t2 t2
            WHERE   t2.t1id = t1.id
                    AND t2.t3id = t3.id
            )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

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.