Question: I have two separate data tables I need a sql query to pull data out of . The first table is called Collected _ Details
I have two separate data tables I need a sql query to pull data out of
The first table is called CollectedDetails and containsa DCID column and a CollectionID column. The DCID column contains the names of completed text entryforms and the CollectionID column contains unique ID numbers generated each time a text entry form has data entered into it
The second table is called SampleDetails and contains a CollectionID DCEID Val and PerformedDate columns.The CollectionID column contains the unique IDs generated from the CollectedDetails table. The DCEID column containsnames of the entries and the Val column contains the values inputted for those entries. The PerformedDateColumn marks when the entry form was completed.
The sql query needs to have a search field for the DCID column from theCollectedDetails table. The DCID values that will be searched for are GummyWorm, GummyBear, TaffyBased on the name searched for in the DCID column, the query needs to pull out each associated ID number generated from the CollectionID column. It then needs to take those CollectionID numbers and search for them in the SampleDetails table Returning the values from the DCEID Val and PerformedDate Columns. Data returned should be ordered by most recent performed date to least recent.
Below is the code i currently have; however it does not work. I am receiving "invalid identifier errors"
SELECTsd.DCEIDsdVal,sdPerformedDate FROM SampleDetails WHERE sdCollectionID IN SELECT cdCollectionIDFROM CollectedDetails cdWHERE sdDCID IN CDASAMPLESUMMARY', LNSAMPLESUMMARY', 'HPOSAMPLESUMMARY' ORDER BY sdPerformedDate DESC;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
