Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
edited body; edited title
Source Link
marc_s
  • 760k
  • 186
  • 1.4k
  • 1.5k

Match the column values between two tables in SQLServerSQL Server

I have two tables:
ReservationName

ReservationName

 +-------+-------+-------+-------+ | Name | +-------+-------+-------+-------+ | Brad Pitt | | Morgan Freeman | | Bobby deniro | +-------+-------+-------+-------+ 

BookingDetails

 +-------+-------+-------+-------+ | Name | ID |Eid | Eid | +-------+-------+-------+-------+ | Brad Pitt | 1 | ab123 | ab123 | | Morgan Freeman | 2 | pq123 | pq123 | | Bobby deniro | 3 | rs123 | rs123 | +-------+-------+-------+-------+ 

I have to match the names in ReservationName with BookingDetails . If

If they are same (count and value) .

Above example of mine should return true as names are identical and count is 3. The aforementioned condition is part of If exists logic that I am using in spa stored procedure.

Match the column values between two tables in SQLServer

have two tables:
ReservationName

 +-------+-------+-------+-------+ | Name | +-------+-------+-------+-------+ | Brad Pitt | | Morgan Freeman | | Bobby deniro | +-------+-------+-------+-------+ 

BookingDetails

 +-------+-------+-------+-------+ | Name | ID |Eid | +-------+-------+-------+-------+ | Brad Pitt | 1 | ab123 | | Morgan Freeman | 2 | pq123 | | Bobby deniro | 3 | rs123 | +-------+-------+-------+-------+ 

I have to match the names in ReservationName with BookingDetails . If they are same (count and value) .

Above example of mine should return true as names are identical and count is 3. The aforementioned condition is part of If exists logic that I am using in sp.

Match the column values between two tables in SQL Server

I have two tables:

ReservationName

 +-------+-------+-------+-------+ | Name | +-------+-------+-------+-------+ | Brad Pitt | | Morgan Freeman | | Bobby deniro | +-------+-------+-------+-------+ 

BookingDetails

 +-------+-------+-------+-------+ | Name | ID | Eid | +-------+-------+-------+-------+ | Brad Pitt | 1 | ab123 | | Morgan Freeman | 2 | pq123 | | Bobby deniro | 3 | rs123 | +-------+-------+-------+-------+ 

I have to match the names in ReservationName with BookingDetails .

If they are same (count and value) .

Above example of mine should return true as names are identical and count is 3. The aforementioned condition is part of If exists logic that I am using in a stored procedure.

added 17 characters in body
Source Link
juergen d
  • 205.3k
  • 40
  • 305
  • 377

have two tables: 
ReservationName

 +-------+-------+-------+-------+ | Name | +-------+-------+-------+-------+ | Brad Pitt | | Morgan Freeman | | Bobby deniro | +-------+-------+-------+-------+ 

+-------+-------+-------+-------+
| Name |
+-------+-------+-------+-------+
| Brad Pitt |
| Morgan Freeman |
| Bobby deniro |
+-------+-------+-------+-------+ BookingDetails +-------+-------+-------+-------+
| Name | ID |Eid |
+-------+-------+-------+-------+
| Brad Pitt | 1 | ab123 |
| Morgan Freeman | 2 | pq123 |
| Bobby deniro | 3 | rs123 |
+-------+-------+-------+-------+BookingDetails

 +-------+-------+-------+-------+ | Name | ID |Eid | +-------+-------+-------+-------+ | Brad Pitt | 1 | ab123 | | Morgan Freeman | 2 | pq123 | | Bobby deniro | 3 | rs123 | +-------+-------+-------+-------+ 

Above example of mine should return true as names are identical and count is 3. The aforementioned condition is part of If exists logic that I am using in sp.

I am using Sql server

Thanks in advance.

have two tables: ReservationName

+-------+-------+-------+-------+
| Name |
+-------+-------+-------+-------+
| Brad Pitt |
| Morgan Freeman |
| Bobby deniro |
+-------+-------+-------+-------+ BookingDetails +-------+-------+-------+-------+
| Name | ID |Eid |
+-------+-------+-------+-------+
| Brad Pitt | 1 | ab123 |
| Morgan Freeman | 2 | pq123 |
| Bobby deniro | 3 | rs123 |
+-------+-------+-------+-------+

Above example of mine should return true as names are identical and count is 3. The aforementioned condition is part of If exists logic that I am using in sp.

I am using Sql server

Thanks in advance.

have two tables: 
ReservationName

 +-------+-------+-------+-------+ | Name | +-------+-------+-------+-------+ | Brad Pitt | | Morgan Freeman | | Bobby deniro | +-------+-------+-------+-------+ 

BookingDetails

 +-------+-------+-------+-------+ | Name | ID |Eid | +-------+-------+-------+-------+ | Brad Pitt | 1 | ab123 | | Morgan Freeman | 2 | pq123 | | Bobby deniro | 3 | rs123 | +-------+-------+-------+-------+ 

Above example of mine should return true as names are identical and count is 3. The aforementioned condition is part of If exists logic that I am using in sp.

Source Link

Match the column values between two tables in SQLServer

have two tables: ReservationName

+-------+-------+-------+-------+
| Name |
+-------+-------+-------+-------+
| Brad Pitt |
| Morgan Freeman |
| Bobby deniro |
+-------+-------+-------+-------+ BookingDetails +-------+-------+-------+-------+
| Name | ID |Eid |
+-------+-------+-------+-------+
| Brad Pitt | 1 | ab123 |
| Morgan Freeman | 2 | pq123 |
| Bobby deniro | 3 | rs123 |
+-------+-------+-------+-------+

I have to match the names in ReservationName with BookingDetails . If they are same (count and value) .

Above example of mine should return true as names are identical and count is 3. The aforementioned condition is part of If exists logic that I am using in sp.

I am using Sql server

Thanks in advance.