Combine multiple records in a table into one field in another table based on fields in a third table


HOME ยป Databases

I have three tables:


Table 1:
pid, name, address
1 Dale BLANK
Table 2:
pid, moid
1 12
Table 3:
moid, address
12 123 Main
12 12 South
12 99 North

For output I need:


Table 1:
pid, name, address
1 Dawn 123 Mian,12 South,99 North

How can i combine multiple addresses in table 3 into one address field in table 1 linking the two tables with information in table 2?


Related to : Combine multiple records in a table into one field in another table based on fields in a third table
Combine multiple records in a table into one field in another table based on fields in a third table
Databases

I have three tables:


Table 1:
pid, name, address
1 Dale BLANK
Table 2:
pid, moid
1 12
Table 3:
moid, address
12 123 Main
12 12 South
12 99 North

For output I need:


Table 1:
pid, name, address
1 Dawn 123 Mian,12 South,99 North

How can i combine multiple addresses in table 3 into one address field in table 1 linking the two tables with information in table 2?


Updating multiple records for one table based on a condition of a column within that table that is unknown
Databases

I am attempting to update multiple columns to an unknown id that is system generated. The way to find this unknown value is to search by a unique identifier that I have manually added to the DB.


The purpose is to link a child record to a parent record.


in the below the t1.tc_parent_npl_id is known and matches the t1.tc_npl_id


The sql needs to reflect the following logic:



If t1.tc_parent_npl_id (this is the child record value that is known) = t1.tc_npl_id (this is another record (parent record) that exists within the DB) then
t1.parent_npl_id (updating the child record to link

Insert into a table fields from another table based on a field
Databases
Hi All
I have 2 tables (as shown below), if i add a row to the FILES TABLE then the myid value is added to mydata list in the PLAYLISTS TABLE, based on the genre matching the myname values.
Hope this makes sense.
So my question is how do i add myid to mydata when new files are added to the FILES TABLE.
Thanks
FILES TABLE
filepath.........artist..............album.....gen re.......myid
c:/files..........u2..................war........Rock ........1234
c:/files..........u2..................war........Rock ........1235
c:/files..........u2..................war........Rock ........1236
c:/files..........madonn
multiple fields in 1 table joined to 1 field in a 2nd table
Databases
I have not run into this before, and hope there is a solution out there.
Table1 contains 6 fields - fail1, fail2,....fail6
Table2 contains 2 fields - Code, Description
I want my query to JOIN on fail1, fail2..... to CODE and have the 6 different descriptions show in my query output.
I can create the joins to CODE, but can't get the Description to show 6 times.
I hope I explained this correctly.
Any Ideas?
Thanks
Kevin

Auto update fields from one table based on a field in another table
Databases
I have created a data entrey form where user would enter the employee id and I would like to automatically update empoyee name, salary on this table from the employees table. I have spent so much time and can't go any far. I am very new to VB.
thanks

Qry header table records based on form table field without duplicates
Databases
This sql statement is returning the results that I want, but it is returning each record multiple times based on how many records there are in the subTable. How can i set this up so it only returns only one instance of each record?
Code:
SELECT tblReportHeader.ReportID, tblReportHeader.ReportInvoiceNumber, tblReportHeader.ReportTestDate, tblReportHeader.ReportSampleDate, tblReportHeader.ReportSampleTime, tblReportResults.ReportResultsType
FROM tblReportHeader LEFT JOIN tblReportResults ON tblReportHeader.Re

Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2017 © bighow.org All Rights Reserved .