I have two tables account_agent and bulk_index. The data on each table is as follows
account_agent
name code account remark scheme
avi 10 151362 first as
babi 11 123478 new as
avi 10 151721 new as
avi 10 151765 new as
sam sas/01 925458 tin sas
bulk_index
agentcode account customer_name
10 151362 Alok
22 265721 Rohan
10 151721 Akash
using these tables I want result on account_agent table as follows
account_agent
name code account remark
avi 10 151362 first
avi 10 151721 new
I have tried the query
select * from account_agent where code = '10' and account = (select account from bulk_index where code = '10')
This query worked for me
SELECT A.name, A.code, A.Account, A.remark, A.scheme
FROM account_agent A
INNER JOIN bulk_index B ON A.account = B.account
WHERE A.scheme = 'as' AND A.code = '10'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With