Tricky it is - and original.

Thanks for all the suggestions - I'll try Ed's "trick" and Tomash's
function -
Another option - similar to Tomash's solution - is processing the rows
ordered by group and priority through a "collapsing" callback
That only "accepts" the first row per group.

Thanks again,
Eliedaat

-----Original Message-----
From: Ed Pasma [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 07, 2007 10:28 PM
To: Adler, Eliedaat
Cc: sqlite-users@sqlite.org
Subject: RE: [sqlite] Help wiith SQL - first row of each group

This solution may is tricky but has occasoinaly helped me. It is written
here dedicated for the example data. For real data the leftpadding
should likely be increased to the content of the sorting key. Also the
result may need to be converted to the expected data type, it has now
become text.

SELECT
     g,
     SUBSTR (MAX (SUBSTR ('  ' || p, -2, 2) || v), 3, 1) v FROM
     t
GROUP BY
     g
;


***********************************************************************************
This email message and any attachments thereto are intended only for use by the 
addressee(s) named above, and may contain legally privileged and/or 
confidential information. If the reader of this message is not the intended 
recipient, or the employee or agent responsible to deliver it 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 immediately notify the [EMAIL PROTECTED] and 
destroy the original message.
***********************************************************************************

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to