Kasuni Abegunawardana

Kasuni Abegunawardana

  • NA
  • 211
  • 125.5k

How to select data from multiple tables

Nov 25 2017 8:58 AM
Hi all,
 
I have created two tables as User_tb and consultant_tb in sql server.
 
I just wanna select data from this two tables for the login. Data in those tables are not unique.
 
There is an one login for both users and consultants. When i enter the email and password, it should validate from those two tables and redirect to the different pages.
 
Please let me know the Sql Query.
 
Thank you.
 
Table 1- User_tb
  1. CREATE TABLE [dbo].[User_tb](  
  2. [ID] [int] IDENTITY(1,1) NOT NULL,  
  3. [U_FirstName] [nvarchar](50) NULL,  
  4. [U_LasName] [nvarchar](50) NULL,  
  5. [U_EmailAddress] [nvarchar](50) NOT NULL,  
  6. [U_Password] [nvarchar](50) NULL,  
  7. [U_CurrentWeight] [floatNULL,  
  8. [U_CurrentHeight] [floatNULL,  
  9. [U_Gender] [nvarchar](10) NULL,  
  10. [U_BirthDay] [dateNULL,  
  11. [U_BMI] [floatNULL,  
  12. CONSTRAINT [PK_User_tb] PRIMARY KEY CLUSTERED  
  13. (  
  14. [U_EmailAddress] ASC  
  15. )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ONON [PRIMARY]  
  16. ON [PRIMARY]  
Table 2 - Consultant_tb
  1. CREATE TABLE [dbo].[Consultant_tb](  
  2. [ID] [int] IDENTITY(1,1) NOT NULL,  
  3. [C_SurName] [nvarchar](50) NULL,  
  4. [C_FirstName] [nvarchar](50) NULL,  
  5. [C_MiddelName] [nvarchar](50) NULL,  
  6. [C_NIC_Number] [nvarchar](10) NULL,  
  7. [C_Gender] [nvarchar](10) NULL,  
  8. [C_Nationality] [nvarchar](50) NULL,  
  9. [C_Address] [nvarchar](100) NULL,  
  10. [C_PostalCode] [nvarchar](50) NULL,  
  11. [C_TelephoneNumber] [intNULL,  
  12. [C_MobileNumber] [intNULL,  
  13. [C_MedicalLicenceNumber] [nvarchar](50) NULL,  
  14. [C_EmailAddress] [nvarchar](50) NOT NULL,  
  15. [C_Password] [nvarchar](50) NULL,  
  16. [C_DegreeName] [nvarchar](50) NULL,  
  17. [C_University] [nvarchar](50) NULL,  
  18. [C_YearObtained] [dateNULL,  
  19. [C_AdditionalQualification] [nvarchar](500) NULL,  
  20. [C_Experience] [nvarchar](500) NULL,  
  21. [C_Evidence] [nvarchar](50) NULL,  
  22. [C_Advertisement] [nvarchar](50) NULL,  
  23. CONSTRAINT [PK_Consultant_tb] PRIMARY KEY CLUSTERED  
  24. (  
  25. [C_EmailAddress] ASC  
  26. )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ONON [PRIMARY]  
  27. ON [PRIMARY]

Answers (13)