Results 1 to 5 of 5

Thread: quick and dirty sql

  1. #1
    Join Date
    Apr 2009
    Posts
    3

    quick and dirty sql

    trying to fudge a dnn report, all the data is in 1 table with 2 fields,
    fieldid field1
    1 data
    2 moredata

    i can pull a quick select field1 from table where fieldid=2
    result=moredata

    but what i need is more like

    select field1 as field1, field1 as field2
    from table
    where fieldid=1, fieldid=2

    result:
    field1 field2
    data moredata

    just not sure, can you point me in the right direction, thanks in advance.

  2. #2
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    What is dnn report?.

    With only two columns how do you know which data and more data correspond to the same row in result.

    This may work

    select field1,null as field2
    from table
    where fieldid=1
    union all
    select null as field1,field2
    from table
    where fieldid=2

  3. #3
    Join Date
    Apr 2009
    Posts
    3

    works great,, almost

    dnn=dotnetnuke

    ok, works great pulls 2 columns of the columns i need, only issue is it pulls them not lined up, for instance each of these has 24 results in each column, but the result was 48 rows long,
    i need to start the second column at row 1 with the 1 record of column 1

    thank you so much for your help, its people like you that share your info help me to learn more

  4. #4
    Join Date
    Apr 2009
    Posts
    3
    bump, still looking for an answer thanks again.

  5. #5
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254

Posting Permissions

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