Article View: pl.comp.bazy-danych
Article #183479Re: [mssql] Jak zrobić takie złączenie?
From: Łukasz Ledóchowski
Date: Mon, 13 Jul 2009 19:21
Date: Mon, 13 Jul 2009 19:21
46 lines
1709 bytes
1709 bytes
wloochacz wrote:
> join z like niczego nie załatwi - nie ma warunku złączenia.
SELECT
A.ADRES,
O.OBSZAR
FROM ADRESY A
JOIN OBSZARY O
ON A.ADRES LIKE '%' + O.KOD_POCZTOWY + '%'
:)?
CREATE TABLE ADRESY
(
ID INT NOT NULL,
ADRES VARCHAR(100) NOT NULL
)
INSERT INTO ADRESY
VALUES
(1,'ul. strzelców 1 40-466 Opole'),
(2,'ul. mocherowa 666 66-666 Toruń'),
(3,'ul. jablek 3m7 79-987 Nowa Wieś')
CREATE TABLE OBSZARY
(
KOD_POCZTOWY CHAR(6) NOT NULL,
OBSZAR VARCHAR(10) NOT NULL
)
INSERT INTO OBSZARY
VALUES
('66-666','Duży'),
('40-466','Mały'),
('15-977','Mały'),
('79-987','Średni')
--
Łukasz Ledóchowski
GG:503647 lukled@tlen.pl
Technical Details
Message-ID:
<h3g1f6$3pv$1@atlantis.news.neostrada.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.rmf.pl!agh.edu.pl!news.agh.edu.pl!news.onet.pl!newsfeed.neostrada.pl!nemesis.news.neostrada.pl!atlantis.news.neostrada.pl!news.neostrada.pl!not-for-mailReferences:
<h3eucn$9nm$1@mx1.internetia.pl> <h3f11p$3v3$1@nemesis.news.neostrada.pl>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.rmf.pl!agh.edu.pl!news.agh.edu.pl!news.onet.pl!newsfeed.neostrada.pl!nemesis.news.neostrada.pl!atlantis.news.neostrada.pl!news.neostrada.pl!not-for-mail From: Łukasz Ledóchowski <lukled@tlen.pl> Newsgroups: pl.comp.bazy-danych Subject: Re: [mssql] Jak zrobić takie złączenie? Date: Mon, 13 Jul 2009 19:21:11 +0000 (UTC) Organization: TP - http://www.tp.pl/ Lines: 46 Message-ID: <h3g1f6$3pv$1@atlantis.news.neostrada.pl> References: <h3eucn$9nm$1@mx1.internetia.pl> <h3f11p$3v3$1@nemesis.news.neostrada.pl> NNTP-Posting-Host: cdh224.neoplus.adsl.tpnet.pl Mime-Version: 1.0 X-Trace: atlantis.news.neostrada.pl 1247512871 3903 83.30.157.224 (13 Jul 2009 19:21:11 GMT) X-Complaints-To: usenet@news.neostrada.pl NNTP-Posting-Date: Mon, 13 Jul 2009 19:21:11 +0000 (UTC) User-Agent: XanaNews/1.18.1.3 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit