I still think the DISTINCT(ContentID) should work...what happens? what is the SQL you used when testing it?

Bryan Stevenson B.Comm.
VP & Director of E-Commerce Development
Electric Edge Systems Group Inc.
phone: 250.480.0642
fax: 250.480.1264
cell: 250.920.8830
e-mail: [EMAIL PROTECTED]
web: www.electricedgesystems.com

  ----- Original Message -----
  From: Bosky, Dave
  To: SQL
  Sent: Friday, August 20, 2004 1:49 PM
  Subject: RE: return only one row for each id field that meets the criteria .

  I need the content id to perform an update. Is there no way to make it
  function with the column?

  ~Dave

    _____  

  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
  Sent: Friday, August 20, 2004 4:46 PM
  To: SQL
  Subject: RE: return only one row for each id field that meets the criteria .

  What (if anything) are you doing with the contentid column?  It is the
  presence of that column that is throwing the monkey wrench into the query.
  If you don't need it, get rid of it.
  _____________________
  Eric
  _____________________
  "You can tell the ideals of a nation by its advertisements."
  -- Norman Douglas

  "Raster, Tim" <[EMAIL PROTECTED]>
  08/20/2004 04:30 PM
  Please respond to sql

          To:     SQL <[EMAIL PROTECTED]>
          cc:
          Subject:        RE: return only one row for each id field that meets
  the criteria .

  Because you have different values for your ContentID and DateDisplayEnd
  columns, you can't do it in a single pass.  You'll have to either used a
  stored procedure to do it in 2 steps, or use a SubQuery (which I guess
  is a "single pass" but I still kind of consider it a hacked-up way of
  doing 2 steps).

  -----Original Message-----
  From: Bosky, Dave [mailto:[EMAIL PROTECTED]
  Sent: Friday, August 20, 2004 15:29
  To: SQL
  Subject: RE: return only one row for each id field that meets the
  criteria .

  Yeah. I tried DISTINCT and it didn't work nor did the GROUP BY.

  It seems like there should be a simple solution but....maybe I'll
  looking at
  it too much :-)

  Thanks. Any additional suggestions are welcome.

    _____

  From: Bryan Stevenson [mailto:[EMAIL PROTECTED]
  Sent: Friday, August 20, 2004 4:18 PM
  To: SQL
  Subject: Re: return only one row for each id field that meets the
  criteria.

  Well you could use DISTINCT(id) in your SELECT list or add a GROUP BY
  clasue
  on the ID.  The DISTINCT is slower, but I don't think GROUP BY will work
  as
  you'd need to group by ALL fields in the SELECT list which may not work
  for
  you.

  Also...if it's being output by CF you always have the option on using a
  query of a query to get the proper groupings

  HTH

  Cheers

  Bryan Stevenson B.Comm.
  VP & Director of E-Commerce Development
  Electric Edge Systems Group Inc.
  phone: 250.480.0642
  fax: 250.480.1264
  cell: 250.920.8830
  e-mail: [EMAIL PROTECTED]
  web: www.electricedgesystems.com

    ----- Original Message -----
    From: Bosky, Dave
    To: SQL
    Sent: Friday, August 20, 2004 1:12 PM
    Subject: return only one row for each id field that meets the
  criteria.

    I have a query that returns the following information.

    I need it to return only one row for each id field that meets the

    criteria, which should be the 2 rows that are bolded( ids: 20 and 37).

    QUERY:
    ----------------------------------------------
    SELECT     id, contentid, dateDisplayEnd
    FROM         dbo.tbl_menu_content
    WHERE     (dateDisplayEnd > GETDATE())
    AND (contentQueueID = 2)
    ORDER BY id, dateDisplayEnd
    ----------------------------------------------

    RESULTS:
    id      contentid    dateDisplayEnd
    ----------------------------------------------
    20    100          8/21/2004 12:00:01 AM
    20    102        8/21/2004 12:00:01 AM
    20    103        8/21/2004 12:00:01 AM
    20    104        8/21/2004 12:00:01 AM
    20    108        8/21/2004 12:00:01 AM
    20    119        8/31/2004 12:00:01 AM
    37    106        8/24/2004 12:00:01 AM
    ----------------------------------------------

    Regards,

    Dave Bosky

    Programmer/Analyst

    Horry Telephone Cooperative, Inc.

    office: 843.369.8613

    email:  <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED]

    HTC Disclaimer:  The information contained in this message may be
  privileged and confidential and protected from disclosure. If the reader
  of
  this message is not the intended recipient, or an employee or agent
  responsible for delivering this message to the intended recipient, you
  are
  hereby notified that any dissemination, distribution or copying of this
  communication is strictly prohibited.  If you have received this
  communication in error, please notify us immediately by replying to the
  message and deleting it from your computer.  Thank you.

    _____
  ________________________________

    _____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to