Source language: Translate to:

Copy all data in one field to another field of same table

Questions about our Advanced Database plug-in

Moderator: Neosoft Support

Copy all data in one field to another field of same table

Postby donmichel » Mon May 16, 2011 9:37 am

Hai all,
Is there a way to copy all rows from one field to another field in the same table? It is for reporting purpose. I have to use the following SQL for merging data from two different tables:
SELECT Comm_App_No,Cand_Name,WG FROM SSLC WHERE Choice1='1' OR Choice2='1' OR Choice3='1'
UNION
SELECT Comm_App_No,Cand_Name,WG FROM CBSE WHERE Choice1='1' OR Choice2='1' OR Choice3='1'
But the problem is WG should should get data from fields with different names in the two tables. Please help me.
donmichel
 
Posts: 38
Joined: Sun Sep 14, 2008 1:25 am

Postby Neosoft Support » Mon May 16, 2011 10:31 am

Is there a way to copy all rows from one field to another field in the same table?


To copy from one field to another in the same table, you could try something like this:

Code: Select all
dbpFirst "DB" "Table"
Loop "1" "[DB.Table.$RecCount]" "[Counter]"
  SetVar "[DB.Table.Field2]" "[DB.Table.Field1]"
  dbpNext "DB" "Table"
EndLoop
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5603
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby cp4w » Mon May 16, 2011 2:11 pm

Is there a way to copy all rows from one field to another field in the same table?


Using SQL, something like this ( I don't remember the exact syntax )
Code: Select all
UPDATE
    TABLEX
SET
    COLUMNY = COLUMNZ;
cp4w
 
Posts: 533
Joined: Sun Apr 03, 2005 4:37 pm
Location: Great Neck, NY

Postby donmichel » Tue May 17, 2011 10:35 am

Both codes work perfectly well. Thanks a lot.
donmichel
 
Posts: 38
Joined: Sun Sep 14, 2008 1:25 am


Return to NeoBookDBPro

Who is online

Users browsing this forum: No registered users and 2 guests

cron