Subject Re: [firebird-support] How to add addition record in sql output
Author Vishal Tiwari
Hi,
 
Thank You Mr. DOM, Rajiv Dular Singh Chauhan, Mr. Paul R. Alrick-
 
Thanks for your valuable help.
 
I would like to achieve this using only sql staement.
 
As Mr. DOM has given an example, which matches to the requirement.
 
But i need to study and work on this example, because depending upon the data in the database it gives the result, some time one record and some time more records as i tried to use "UNION" with different columns with different values.
 
Mr. DOM, i think very soon i will get back to you as i will be surrounded by some doubts.
 
As you questioned, "why i need?", coz for calculation, some times i need fixed no. of records and in database some times it may not be available the required no. of records, so using sql if i get required records with some initialised fix values then it help me to get result within time.
 
Thanks once again to all.
 
If any other way to acieve this using sql will be highly appreciated.
 
Have A Nice Day.
 
 
Vishal

--- On Sat, 17/4/10, Dom Scarlatti <scarlatti@...> wrote:


From: Dom Scarlatti <scarlatti@...>
Subject: Re: [firebird-support] How to add addition record in sql output
To: firebird-support@yahoogroups.com
Date: Saturday, 17 April, 2010, 10:19 AM


 



At 02:37 PM 17/04/2010, you wrote:
>Hi All,
>
>
>I have a small doubt(and requirement also), if i am executing an sql statement and it is giving 10 records as an output, is it possible to get some extra rows with this output with some initial values or with no values for specified or for all columns.
>
>For example, if i am getting 10 records as an output, is it possible to get an extra records means total 11 records (i.e. one extra record with or without values).
>
>As per my efforts it seems to be not possible, but still i would like to clarify this doubt.
>
>But i would like to do this effort with sql statement.

SELECT F1, F2, F3,.... etc..../* your real data */
WHERE...
UNION
SELECT '', null, 0, ...etc... /* your dummy row, literals matching types 1:1 */

(But why???)

N.B. This is not an updatable set.

Dom










[Non-text portions of this message have been removed]