Unfortunately for you, Paul, the SQL definition of a table is "an unordered
set of rows." So the concept of a "next row" is problematic to building a
query. Your query provides the order through the ORDER BY clause.
Will the ID2 column match a ID1 column more than once in the table?
I'd be working on something like:
SELECT t1.ROWID, t1.PART_ID, t1.ID1, t1.ID2 +
FROM tablename t1 +
WHERE t1.ID2 NOT IN +
(SELECT t2.ID2 FROM tablename t2) +
ORDER BY 1,2,3,4
Bill
On Tue, Nov 27, 2018 at 10:27 AM <[email protected]> wrote:
> Dan,
>
>
>
> It will always be the previous row. I would sort on the ID1 column so it
> would always be the previous row.
>
>
>
> Thanks,
>
> Paul
>
>
>
> *From:* [email protected] <[email protected]> *On Behalf Of
> *Dan Goldberg
> *Sent:* November 27, 2018 10:09 AM
> *To:* [email protected]
> *Subject:* RE: [RBASE-L] - SQL Help - OT
>
>
>
> Is it only from the previous row or any of the rows?
>
>
>
> Dan Goldberg
>
>
>
>
>
> *From:* [email protected] <[email protected]> *On Behalf Of
> *[email protected]
> *Sent:* Tuesday, November 27, 2018 6:48 AM
> *To:* [email protected]
> *Subject:* RE: [RBASE-L] - SQL Help - OT
>
>
>
> Dan,
>
>
>
> Thanks but it’s only coincidental that the sample I created I needed the
> “odd” rowid’s. My guess is it will be 50/50 odd or even.
>
>
>
> What I need is to check ID1 & ID2 and if the ID1 from the next row equals
> the ID2 from the previous row I don’t select that row.
>
>
>
> Thanks anyway,
>
> Paul
>
>
>
> *From:* [email protected] <[email protected]> *On Behalf Of
> *Dan Goldberg
> *Sent:* November 27, 2018 9:37 AM
> *To:* [email protected]
> *Subject:* RE: [RBASE-L] - SQL Help - OT
>
>
>
> You can do this to get the odd rowid values in rbase.
>
>
>
> Select ROWID, PART_ID, ID1, ID2 from tablename where (MOD(ROWID,2)) = 1
>
>
>
> Dan Goldberg
>
>
>
>
>
>
>
> *From:* [email protected] <[email protected]> *On Behalf Of
> *[email protected]
> *Sent:* Tuesday, November 27, 2018 6:23 AM
> *To:* [email protected]
> *Subject:* [RBASE-L] - SQL Help - OT
>
>
>
> Good morning,
>
>
>
> I need some help with a SQL select command, not specifically for R:BASE.
> See my little table sample below. What I’d like to end up with after the
> SQL select is the following rows:
>
>
>
> *Results of SQL Select/Query*
>
> *ROWID* *PART_ID* *ID1*
> *ID2*
>
> 1 PV216365006R
> -00105 -00106
>
> 3 PV216365006R
> -00107 -00108
>
> 5 PV216365006R
> -00109 -00110
>
> 7 PV216365006R
> -00111 -00112
>
>
>
> *Sample Table to Query*
>
> *ROWID* *PART_ID* *ID1*
> *ID2*
>
> 1 PV216365006R
> -00105 -00106
>
> 2 PV216365006R
> -00106 -00105
>
> 3 PV216365006R
> -00107 -00108
>
> 4 PV216365006R
> -00108 -00107
>
> 5 PV216365006R
> -00109 -00110
>
> 6 PV216365006R
> -00110 -00109
>
> 7 PV216365006R
> -00111 -00112
>
> 8 PV216365006R
> -00112 -00111
>
>
>
> I know how I’d do this in a Declare statement in R:BASE but as I said, it
> has to be done with a SQL select command.
>
>
>
> Any blues clues would be greatly appreciated.
>
>
>
> TIA,
>
> Paul Buckley
>
> --
> For group guidelines, visit
> http://www.rbase.com/support/usersgroup_guidelines.php
> ---
> You received this message because you are subscribed to the Google Groups
> "RBASE-L" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
> --
> For group guidelines, visit
> http://www.rbase.com/support/usersgroup_guidelines.php
> ---
> You received this message because you are subscribed to the Google Groups
> "RBASE-L" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
> --
> For group guidelines, visit
> http://www.rbase.com/support/usersgroup_guidelines.php
> ---
> You received this message because you are subscribed to the Google Groups
> "RBASE-L" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
> --
> For group guidelines, visit
> http://www.rbase.com/support/usersgroup_guidelines.php
> ---
> You received this message because you are subscribed to the Google Groups
> "RBASE-L" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
> --
> For group guidelines, visit
> http://www.rbase.com/support/usersgroup_guidelines.php
> ---
> You received this message because you are subscribed to the Google Groups
> "RBASE-L" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
For group guidelines, visit
http://www.rbase.com/support/usersgroup_guidelines.php
---
You received this message because you are subscribed to the Google Groups
"RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.