Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Using a query to expand a data set

$
0
0

My only experience with sql queries is to return a defined set of data, but now I need to expand a data set.  My data table is populated as follows:

Tenant    Rent    Lease_from       Lease_to

    A        $100    1 Jan 2013    31 Jun 2013

    A        $150    1 Jul 2013     31 Dec 2014

    B        $50      1 Jan 2013    31 Dec 2014

Is there a way to construct a query that will expand this information as follows:

Tenant    Rent    Lease_from       Lease_to      Month     Year

    A        $100    1 Jan 2013    31 Jun 2013      Jan       2013

    A        $100    1 Jan 2013    31 Jun 2013      Feb       2013

    A        $100    1 Jan 2013    31 Jun 2013      Mar       2013

etc..

This may be basic, but I am just a beginner.

Any help much appreciated.  Thanks...


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>