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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:27:33+00:00 2026-06-13T07:27:33+00:00

SQL Server 2000 Using More than 20 views, all the views are inner join

  • 0

SQL Server 2000

Using More than 20 views, all the views are inner join with table1 (id and value1 and value2)

Table1

ID Value1 Value2

001 100 null
001 200 null
001 300 null
001 400 null
001 200 null

or

ID Value1 Value2

001 null 100 
001 null 200 
001 null 300 
001 null 400 
001 null 200 

Table2

ID value1 value2

....
....

some data's

from the table1, either value1 or value2 should always be null. now the problem is if the
value1 or value2 column is null, then output is showing null because all the views are inner join with id, value1, value2

I want to make a inner join with condition, if the value1 is not null then inner join with
value1 or if the value2 is not null then inner join with value2

Query like this

Select * from table2 inner join with table1 on tabel2.id = table1.id and if table1.value1 is null then table2.value2 = table1.value2 or
else table2.value1 = table1= value1 end if

How to make a query for the above condition

Need SQL Query Help

  • 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-13T07:27:34+00:00Added an answer on June 13, 2026 at 7:27 am

    Would something like the following work?

    SELECT * FROM table2
    INNER JOIN WITH table1 ON table2.id = table1.id
        AND (table1.value1 = table2.value1 OR table1.value1 IS NULL)
        AND (table1.value2 = table2.value2 OR table1.value2 IS NULL)
    

    I think this might prove to be quite slow if you had a large data set however…

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

Sidebar

Related Questions

Using SQL Server 2000 Table1 ID Date Value1 Value2 001 01/01/2012 100 0 001
Using SQL Server 2000 table1 id values (datatype is nvarchar) 001 12:10 002 01:25
Using SQL Server 2000 Table1 Id date --- ---------- 001 23/01/2012 002 25/01/2012 003
Using SQL Server 2000 and VB6 Table1 ID Date 001 20090801 001 20090802 …
Using SQL Server 2000 table1 id date time 001 01/02/2012 02:00 001 02/02/2012 01:00
Using SQL Server 2000 Table PersonID Date 001 11-02-2009 002 11-02-2009 003 11-02-2009 001
Using SQL Server 2000 Table1 ID A001 A002 A003 A004 A005 A006 A007 ....
Using SQL Server 2000 Table1 Column1 20 30 40 20 40 30 30 I
We have some unit tests running against a SQL server 2000 database using the
How to you automate SQL Server 2000 incremental backups using SQL Server Agent and

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.