Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6859747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:19:19+00:00 2026-05-27T02:19:19+00:00

I am working with price data for futures contracts. I have data for Dec.

  • 0

I am working with price data for futures contracts. I have data for Dec. 2010 and Mar. 2011, that I have loaded into the db.
I want to generate a flat file with the time series that includes both contracts. So, let’s say Dec. 2010 expires on Dec. 31, 2010. On that day I will switch to the prices from the Mar. ’11 contract. Before that, I do not want to capture the Mar. 11 contract.
I know how to do the first step of the process, i.e. get the data for the Dec. 2010 contract, but I am trying to figure out if I should run a separate query and append to the data file, or is there a way I can modify my SQL to handle the above.
This is the code I have written in my perl file.

my $sql=SELECT c_name, t_date, t_price,t_volume FROM $tblname where c_name='FZ10';

If I write a second query, that will be:

my $sql=SELECT c_name, t_date, t_price,t_volume FROM $tblname where c_name='FH11';

my $sth = $dbh->prepare($sql) or die $dbh->errstr;
$sth->execute or die $sth->errstr;
open(FOUT, "> prices.dat");

Can you please let me know what is the best way to combine these 2 time series (given the date constraints) into a flat file.
thx!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T02:19:19+00:00Added an answer on May 27, 2026 at 2:19 am

    What you are looking for is the UNION operator. Try that query:

    SELECT c_name, t_date, t_price,t_volume FROM $tblname where c_name='FZ10'
    UNION
    SELECT c_name, t_date, t_price,t_volume FROM $tblname where c_name='FH11'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a working query that retrieves the data that I need, but unfortunately
I am working on a site that needs to display inventory data. I am
I have everything working from the tutorial, replacing it with my data, but it
I have code to retrieve data from a database into a form but it
I am making a project that sells product and I want to have a
What are your thoughts on this? I'm working on integrating some new data that's
I'm currently working with MS SQL 2005, and have a table that has 17
I'm working with some imported data that stores details about whether a room is
I have a site that displays data on travel products from a MySQL database.
Here's the XML code I'm working with: <inventory> <drink> <lemonade supplier=mother id=1> <price>$2.50</price> <amount>20</amount>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.