Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 How make a Editable Union SQL

Author  Topic 

Vinamr
Starting Member

3 Posts

Posted - 2010-08-03 : 00:21:37
Hi SQL Experts,

This is my first question on this forum.

I have a SQL table that captures child registration information. Unfortunately because of time constraints we captured upto 4 childrens (from the same family) registration information in the same table.

The question is .. how do I display each childs records in a separate row on the front end. I have used a UNION to display each childs record however the record is not getting updated with a union.

Here is an example of the SQL:
Select CM_Registrations.ID,
CM_Registrations.Date_Created,
CM_Registrations.Child1_Fullname,
CM_Registrations.Child1_BV_Enrolled,
CM_Registrations.Parent_ID
From CM_Registrations
Where CM_Registrations.Child1_Fullname Is Not Null
Union
Select CM_Registrations.ID,
CM_Registrations.Date_Created,
CM_Registrations.Child2_Fullname,
CM_Registrations.Child2_BV_Enrolled,
CM_Registrations.Parent_ID
From CM_Registrations
Where CM_Registrations.Child2_Fullname Is Not Null
Union
Select CM_Registrations.ID,
CM_Registrations.Date_Created,
CM_Registrations.Child3_Fullname, CM_Registrations.Child3_BV_Enrolled,,
CM_Registrations.Parent_ID
From CM_Registrations
Where CM_Registrations.Child3_Fullname Is Not Null
Union
Select CM_Registrations.ID,
CM_Registrations.Date_Created,
CM_Registrations.Child4_Fullname,
CM_Registrations.Child4_BV_Enrolled,
CM_Registrations.Parent_ID
From CM_Registrations
Where CM_Registrations.Child4_Fullname Is Not Null
Order By CM_Registrations.ID Desc

Vinnie881
Master Smack Fu Yak Hacker

1231 Posts

Posted - 2010-08-03 : 02:11:25
This forum is not really for front end coding.

You would update the table like so

update a
set
--Field you want
Child4_FullName = 'whatever you want'
from cm_Registrations a
where ID = 2 --Your ID





Success is 10% Intelligence, 70% Determination, and 22% Stupidity.
\_/ _/ _/\_/ _/\_/ _/ _/- 881
Go to Top of Page
   

- Advertisement -