Subject | union with insert select |
---|---|
Author | Ben Johnson |
Post date | 2002-08-11T02:17:17Z |
Hi,
The following SQL statment gives an error with UNION key word. If
I remove union and make
it to two statment it works! And UNION works without the INSERT
statment also! Is this an
expected behaviour of FB ?
INSERT INTO T_LEDGER ( entry_date, account_nm, narration, debit,
credit, journal_no )
SELECT account_book.entry_date, account_heads.account_nm,
account_book.narration,
account_book.debit, account_book.credit,
account_book.journal_no
FROM account_book, account_heads
WHERE ( account_book.l_account_id = account_heads.id )
AND ( ( account_book.entry_date >= :dFrom ) AND (
account_book.entry_date <= :dTo )
AND ( account_book.account_id = :dAcID ) )
UNION
SELECT account_book.entry_date, account_heads.account_nm,
account_book.narration,
account_book.credit, account_book.debit,
account_book.journal_no
FROM account_book, account_heads
WHERE ( account_book.account_id = account_heads.id )
AND ( ( account_book.entry_date >= :dFrom ) AND (
account_book.entry_date <= :dTo )
AND ( account_book.l_account_id = :dAcID ) );
Thank you.
Ben
__________________________________________________________
Give your Company an email address like
ravi @ ravi-exports.com. Sign up for Rediffmail Pro today!
Know more. http://www.rediffmailpro.com/signup/
The following SQL statment gives an error with UNION key word. If
I remove union and make
it to two statment it works! And UNION works without the INSERT
statment also! Is this an
expected behaviour of FB ?
INSERT INTO T_LEDGER ( entry_date, account_nm, narration, debit,
credit, journal_no )
SELECT account_book.entry_date, account_heads.account_nm,
account_book.narration,
account_book.debit, account_book.credit,
account_book.journal_no
FROM account_book, account_heads
WHERE ( account_book.l_account_id = account_heads.id )
AND ( ( account_book.entry_date >= :dFrom ) AND (
account_book.entry_date <= :dTo )
AND ( account_book.account_id = :dAcID ) )
UNION
SELECT account_book.entry_date, account_heads.account_nm,
account_book.narration,
account_book.credit, account_book.debit,
account_book.journal_no
FROM account_book, account_heads
WHERE ( account_book.account_id = account_heads.id )
AND ( ( account_book.entry_date >= :dFrom ) AND (
account_book.entry_date <= :dTo )
AND ( account_book.l_account_id = :dAcID ) );
Thank you.
Ben
__________________________________________________________
Give your Company an email address like
ravi @ ravi-exports.com. Sign up for Rediffmail Pro today!
Know more. http://www.rediffmailpro.com/signup/