Merge and aggregate datasets: Difference between revisions

Content added Content deleted
(Harbour: allow multiple INSERT values)
Line 801: Line 801:
<syntaxhighlight lang="xbase">
<syntaxhighlight lang="xbase">
&& SQL-like INSERT command (note the variable number of arguments)
&& SQL-like INSERT command (note the variable number of arguments)
#xcommand INSERT INTO <table> ( <uField1>[, <uFieldN> ] ) VALUES ( <uVal1>[, <uValN> ] ) => ;
#xcommand INSERT INTO <table> ( <uField1>[, <uFieldN> ] ) VALUE ( <uVal1>[, <uValN> ] ) => ;
<table>->(dbAppend()); <table>-><uField1> := <uVal1> [; <table>-><uFieldN> := <uValN> ]
<table>->(dbAppend()); <table>-><uField1> := <uVal1> [; <table>-><uFieldN> := <uValN> ]
#xcommand INSERT INTO <table> ( <uFieldList,...> ) VALUES ( <uValList1,...> ) [, ( <uValListN,...> )] => ;
INSERT INTO <table> ( <uFieldList> ) VALUE ( <uValList1> ) ;
[; INSERT INTO <table> ( <uFieldList> ) VALUE ( <uValListN> )]


PROCEDURE Main()
PROCEDURE Main()
Line 812: Line 815:
pStruct := {{"patient_id", "n", 8, 0}, {"lastname", "c", 10, 0 }}
pStruct := {{"patient_id", "n", 8, 0}, {"lastname", "c", 10, 0 }}
dbCreate( "patient", pStruct,, .T., "patient" )
dbCreate( "patient", pStruct,, .T., "patient" )
INSERT INTO patient (patient_id, lastname) VALUES (1001, "Hopper")
INSERT INTO patient (patient_id, lastname) VALUES (1001, "Hopper"), (2002, "Wirth"), ;
INSERT INTO patient (patient_id, lastname) VALUES (2002, "Wirth")
(3003, "Kemeny"), (4004, "Gosling"), (5005, "Kurtz")
INSERT INTO patient (patient_id, lastname) VALUES (3003, "Kemeny")
INSERT INTO patient (patient_id, lastname) VALUES (4004, "Gosling")
INSERT INTO patient (patient_id, lastname) VALUES (5005, "Kurtz")
INDEX ON patient_id TO pat_id
INDEX ON patient_id TO pat_id