Re: Need help joining 2 table structures into a new structure On 28 Jan, 12:59, Kim <kims...@gmail.com> wrote:
> On Jan 28, 10:44 am, Captain Paralytic <paul_laut...@yahoo.com> wrote:
>
>
>
> > On 28 Jan, 07:49, Kim <kims...@gmail.com> wrote:
>
> > > On Jan 25, 4:10 pm, Captain Paralytic <paul_laut...@yahoo.com> wrote:
>
> > > > On 25 Jan, 13:49, Kim <kims...@gmail.com> wrote:
>
> > > > > On Jan 25, 1:58 pm, Captain Paralytic <paul_laut...@yahoo.com> wrote:
>
> > > > > > You could describe your problem in far fewer (and easier to
> > > > > > understand( lines, if you simple give sample data from the 2 tables
> > > > > > and showing the:
> > > > > > 1) incorrect output that you get
> > > > > > 2) output as you want to see it
>
> > > > > I'll try to do that.
>
> > > > > How do I join `start` and `end` from both csv_country and
> > > > > csv_cityblocks to form a single table with no duplicates `start`-`end`
> > > > > pairs + a new ID + locid (if any) ?
>
> > > > > Sample data for tables:
> > > > > csv_country
> > > > > start_ip end_ip start end cc cn
> > > > > 2.6.190.56 2.6.190.63 33996344 33996351 GB United Kingdom
> > > > > 3.0.0.0 4.17.135.31 50331648 68257567 US United States
> > > > > 4.17.135.32 4.17.135.63 68257568 68257599 CA Canada
> > > > > 4.17.135.64 4.17.142.255 68257600 68259583 US United States
> > > > > 4.17.143.0 4.17.143.15 68259584 68259599 CA Canada
> > > > > 4.17.143.16 4.18.32.71 68259600 68296775 US United States
> > > > > 4.18.32.72 4.18.32.79 68296776 68296783 MX Mexico
>
> > > > > csv_cityblocks
> > > > > start end locid
> > > > > 33996344 33996351 21604
> > > > > 50331648 67276831 223
> > > > > 67276832 67276847 4834
> > > > > 67276848 67277023 223
> > > > > 67277024 67277031 1002
> > > > > 67277032 67277039 223
>
> > > > > csv_citylocation
> > > > > locid cc region city postal latitude longitude dmacode areacode
> > > > > 223 US NULL NULL NULL 38.000000 -97.000000 0 0
> > > > > 1002 US VA Arlington 22202 38.860000 -77.053300 511 703
> > > > > 4834 US MA Boston 02114 42.361600 -71.067400 506 617
> > > > > 21604 GB C3 Cambridge NULL 52.200000 0.116700 0 0
>
> > > > > ipLocation
> > > > > ipLocationID countryID locid
> > > > > 114577 231 223
> > > > > 116132 231 1002
> > > > > 119258 231 4834
> > > > > 68507 79 21604
>
> > > > > ipBlocks is still empty, as Im trying to fill it, but this is how I
> > > > > want it to show
> > > > > 123456870 123456875 114577
> > > > > 134567890 134567895 116132
> > > > > 145678900 145678908 119258
> > > > > 156789010 156789015 68507
>
> > > > You haven't given any column heading for the output. I can't see where
> > > > for example: 134567890 134567895 has come from?
>
> > > I wrote that at the question longer up, but I can say them again.
> > > start end id old_id
>
> > I still cannot see where in your earlier tables the values 134567890
> > 134567895 can have come from???
>
> Oh, I misunderstood you then.
> The start and end values are fictitious. They were only meant to
> illustrate the the structure and values of table ipBlocks.
I asked you to supply sample input data and theassociated output that
you wanted to see. You supplied sample input data and made up some
output that has no relation with the sample input.
How the H*LL do you expect that to be of any use! |