Re: Brick Codes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I think this is what you want:

SELECT *
FROM Locations L, Brick B
WHERE (LEFT(L.'Post Code',3) = LEFT(B.Brick,3))

If you want to select 4 characters change the 3 to 4 :-)

Avoid using spaces and special characters in your column it may give you
problems.


----- Original Message -----
From: "Shaun" <shaun@xxxxxxxxxxxxxx>
To: <php-db@xxxxxxxxxxxxx>
Sent: Tuesday, February 17, 2004 10:04 AM
Subject: Re:  Brick Codes


> Thanks for your reply,
>
> but what I actually need to do is compare the first 3 or 4 digits of the
> postcode stored in locations to the same in the Brick table...
>
>
> "Ricardo Lopes" <lopes@xxxxxxxxxxxxxxx> wrote in message
> news:003501c3f537$ad240050$5501000a@xxxxxxxxxxxxxx
> > That may depend of what database server you are using, for mysql you can
> > use:
> >
> > ........   WHERE (LEFT('Brick',3) = LEFT(Post Code,3))
> >
> > If you are using other dbserver, check your manual.
> >
> > ----- Original Message -----
> > From: "Shaun" <shaun@xxxxxxxxxxxxxx>
> > To: <php-db@xxxxxxxxxxxxx>
> > Sent: Monday, February 16, 2004 10:45 PM
> > Subject:  Brick Codes
> >
> >
> > > Hi,
> > >
> > > I have a table of Locations around the country. My system produces
> reports
> > > based on these Locations. I also have a table containing Brick Codes
> e.g.
> > >
> > > Brick    Post Code
> > > AB51    AB51
> > > AB52    AB52
> > > AB55    AB55
> > > AB56    AB56
> > > AL01    AL1
> > > AL02    AL2
> > > AL03    AL3
> > > AL04    AL4
> > >
> > >
> > > How can I compare the first 3 or 4 letters of the postcode in the
> > Locations
> > > table to the corresponding entry in the Brick Codes table so I can add
> it
> > to
> > > my report?
> > >
> > > Thanks for your help
> > >
> > > --
> > > PHP Database Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux