locked
SQL Query Question RRS feed

  • Question

  • User-125499312 posted

    I have these tables - tblPrintAreas and tblPrintAreaBoxes with these fields:

    Font, FontSize, OrderNumber, PrintAreaID, PrintAreaBoxID

    each PrintArea has multiple PrintAreaBoxes 

    I need a query to get all the rows for a  PrintArea - but with Font listed once.

    I tried DISTINCT and GROUP BY but I had no success.

    can you help me out, please?

    Thanks

    Tuesday, May 17, 2016 4:44 PM

Answers

All replies

  • User2053451246 posted

    Which fields are in which tables?

    For future reference you should post DDL script to make the temp tables and sample data needed for a forum answerer to be able to easily help.

    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    Tuesday, May 17, 2016 4:51 PM
  • User-125499312 posted

    fields:

    tblPrintAreas:  PrintAreaID

    tblPrintAreaBoxes: PrintAreaID,  PrintAreaBoxID, Font, FontSize, OrderNumber

    thanks

    Tuesday, May 17, 2016 5:06 PM
  • User2053451246 posted

    What do you mean by "Font listed once"?  Couldn't the PrintAreaBoxes for a PrintArea have different font values or are they all the same?

    Are you trying to format this for display on a screen or report or something?  So it lists the font for the first row but not for the other rows?  If so that should be handled in the user interface, not the database query.

    Tuesday, May 17, 2016 5:10 PM
  • User-125499312 posted

    ok thanks

    Tuesday, May 17, 2016 5:19 PM
  • User-698989805 posted

    Hello yzidell! Please refer to the following thread:

    http://forums.asp.net/t/2094339.aspx?Category+type+grouping+SQL

    I've given a solution to the similar problem. Hope helps.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, May 18, 2016 6:47 AM