+ Reply to Thread
Results 1 to 3 of 3

values for columns using sql

  1. #1
    Registered User
    Join Date
    12-07-2010
    Location
    south africa
    MS-Off Ver
    Excel 2010
    Posts
    29

    Arrow values for columns using sql

    i new to SQL say i have this:

    SELECT sum(tonsharvested) as kaapstad2011
    FROM T_harvest
    where BlockNameID = "Kaapstad" and year(Dateofharvest) = "2011"

    it gives me a column kaapstad2011 with sufficient values

    why cant i just say

    SELECT sum(tonsharvested) as kaapstad2010
    FROM T_harvest
    where BlockNameID = "Kaapstad" and year(Dateofharvest) = "2010"

    to display kaapstad2010 next to column above?
    Any advise on how to go further will help, cant seem to shift past this mental block.

  2. #2
    Forum Expert ConneXionLost's Avatar
    Join Date
    03-11-2009
    Location
    Victoria, Canada
    MS-Off Ver
    2010
    Posts
    2,952

    Re: values for columns using sql

    Hi,

    Give this a try:

    Please Login or Register  to view this content.
    Cheers,
    Would you like to say thanks? Please click the: " Add Reputation" button, on the grey bar below the post.

  3. #3
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: values for columns using sql

    Nevermind, ConneXionLost's answer is better.
    Is your code running too slowly?
    Does your workbook or database have a bunch of duplicate pieces of data?
    Have a look at this article to learn the best ways to set up your projects.
    It will save both time and effort in the long run!


    Dave

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1