database - INSERT into table including foreign keys to related tables -


please if help,

i have 3 tables: 1. clients; 2 accounts; 3. transactions ...

i want clientid clientname , accountid accountname , insert id`s transactions , other values other fields known ...

clients

clientid | clientname | ... 

accounts

accountid | accountname | ... 

transactions

transid | account id | clientid | value | tax | total 

how can ... tried many many forms of insert statement didnt work

i tried this:

insert transactions (accountid, clientid, value) values  (select accountid accountname = 'some name'   accounts, select clientid clientname = 'some name' clients, 30.00 ) 

value reserved word in ms access.

i think want this:

insert transactions ( accountid, clientid, [value] ) select accounts.accountid, clients.clientid, 30.00 expr1 accounts, clients (((clients.clientname)='jimmy') , ((accounts.accountname)='mark')); 

you'll need rewrite sql fit tables/table names possibly worked me.

you should make sure value double data type, not long integer. (which default number field)


Comments

Popular posts from this blog

Regex find and replace between <div class="customclass"> and </div> tag -

jpa - Passing entitymanager from reflection method -