Return Multiple Rows of the same Student Id (PK)
-
i created a form, but later noticed that i have four rows of student data for 1 ID, how do i bring back the four rows of data?
Ferron
-
i created a form, but later noticed that i have four rows of student data for 1 ID, how do i bring back the four rows of data?
Ferron
Your DB is obviously broken. You can do a select to get the four rows, but if they have the same Id, then you have a bigger issue.
Christian Graus Driven to the arms of OSX by Vista.
-
Your DB is obviously broken. You can do a select to get the four rows, but if they have the same Id, then you have a bigger issue.
Christian Graus Driven to the arms of OSX by Vista.
they have the same id, but different addresses, so i wanna be able to print all those addresses
Ferron
-
i created a form, but later noticed that i have four rows of student data for 1 ID, how do i bring back the four rows of data?
Ferron
is it the way you (outer) join the data in SQL? Could you post your query
-
is it the way you (outer) join the data in SQL? Could you post your query
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[sp_getTransfer] (@TRANSFER_ID int) AS
-- Declare variables
DECLARE @rc Int
SELECT TransferDetails.IMID,TransferDetails.[DESCRIPTION], TransferDetails.AMOUNT,TRANSFERS.AMOUNT_TRANSFER, TRANSFERS.CONSIDERATION, TRANSFERS.TRANSFER_ID,
TRANSFERS.[DATE], TransferDetails.CURR, CUSTOMERS.CMF_NAME_1, CUSTOMERS.CMF_NAME_2,
CUSTOMERS.CMF_ADDR_1, CUSTOMERS.CMF_ADDR_2, CUSTOMERS.CMF_ADDR_3, CUSTOMERS.CMF_ADDR_4,
CUSTOMERS.CMF_POSTAL_CODE, TRANSFERS.Cons_Curr
FROM
("FGBInvestment"."dbo"."TransferDetails" "TransferDetails" INNER JOIN "FGBInvestment"."dbo"."TRANSFERS" "TRANSFERS" ON "TransferDetails"."TRANSFER_ID"="TRANSFERS"."TRANSFER_ID") INNER JOIN "FGBInvestment"."dbo"."CUSTOMERS" "CUSTOMERS" ON "TRANSFERS"."CUSTODIAN"="CUSTOMERS"."CMF_ACCOUNT"
WHERE "TRANSFERS"."TRANSFER_ID"= @TRANSFER_IDFerron
-
i created a form, but later noticed that i have four rows of student data for 1 ID, how do i bring back the four rows of data?
Ferron
I had a look at your query and it seems fine. When you say that you have 4 rows for the same customer ID, do you mean that "CUSTOMERS"."CMF_ACCOUNT" has the same value? If that's your key column (is it appears to be based on the query), I think your data is corrupted. If that's the key column of customers, it should be either primary key or unique key and there would be no duplicates.
The need to optimize rises from a bad design.My articles[^]
-
I had a look at your query and it seems fine. When you say that you have 4 rows for the same customer ID, do you mean that "CUSTOMERS"."CMF_ACCOUNT" has the same value? If that's your key column (is it appears to be based on the query), I think your data is corrupted. If that's the key column of customers, it should be either primary key or unique key and there would be no duplicates.
The need to optimize rises from a bad design.My articles[^]
When i run the query i found that there was a record with 4 different IMID, but the same transfer_id, i want to print those four records on to my form (aspx page)
Ferron
-
When i run the query i found that there was a record with 4 different IMID, but the same transfer_id, i want to print those four records on to my form (aspx page)
Ferron
Based on your query, IMID is a column in TranferDetails and Tranfser_ID is the key column for Transfers, correct? So if you have four rows in TransferDetails for a single transfer_ID, this query will result to four rows. Isn't this what you got when running the query? I'm bit confused since if the situation described above is what you are experiencing, I don't see where the problem is. Or is the problem that your query actually returns four rows, but you're unable to show them simultaneously on aspx page?
The need to optimize rises from a bad design.My articles[^]
-
Based on your query, IMID is a column in TranferDetails and Tranfser_ID is the key column for Transfers, correct? So if you have four rows in TransferDetails for a single transfer_ID, this query will result to four rows. Isn't this what you got when running the query? I'm bit confused since if the situation described above is what you are experiencing, I don't see where the problem is. Or is the problem that your query actually returns four rows, but you're unable to show them simultaneously on aspx page?
The need to optimize rises from a bad design.My articles[^]
yes man, that's exactly what i want too do, thank you man, thank you. Can you show me how ? an example maybe?
Ferron
-
yes man, that's exactly what i want too do, thank you man, thank you. Can you show me how ? an example maybe?
Ferron