erikTsomik
asked on
sql query help
I need to write a query that will tell me if the user exists in the database.
The query below will return all params that I am checking for identification.
query result
if the dataTYpeID = 3 then I need to also query a table bodyDataString its already included in the table above and make sure that the combination last name + firstName + email exists. If it does then user exists
Here the output from bodyDataString
The query below will return all params that I am checking for identification.
SELECT BD.bodyDefinitionID,BDD.bodyDataDefinitionID,BDD.bodyDataName,BDD.dataTypeID
FROM bodyDefinition BD
inner join BodyDataDefinition BDD on BDD.bodyDefinitionID = BD.bodyDefinitionID
left outer join bodyDataString BDS on BDS.bodyDataDefinitionID = BDD.bodyDataDefinitionID
WHERE BDD.bodyDefinitionID = 10
query result
bodyDefinitionID bodyDataDefinitionID bodyDataName dataTypeID
---------------- -------------------- ---------------------------------------------------------------------------------------------------- -----------
10 149 Last Name 3
10 150 First Name 3
10 151 Email 3
if the dataTYpeID = 3 then I need to also query a table bodyDataString its already included in the table above and make sure that the combination last name + firstName + email exists. If it does then user exists
Here the output from bodyDataString
bodyDataStringID bodyID bodyDataDefinitionID bodyData
---------------- ----------- -------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -----------------------
297 98 149 Erik
296 98 150 Erik
298 98 151 test@tesxt.com
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Can you please provide few rows from both the tables and the expected output?