From: "Marcus Kent" <marcuskent@minnescro.com>
Subject: Financial Freedom Here Bob
Date: Wed, 18 Jan 2006 05:22:05 -0500
><html><head>
><style type=3D"text/css">
>A {color:E80079;
>font-family: arial, sans-serif;
>font-size: 10pt; text-decoration:underline}
>A:visited {color:E80079}
>A:active {color:E80079}
>A:hover {color:666666; text-decoration:none}
>link8 A {color:666666;
>font-family: arial, sans-serif;
>font-size: 8pt; text-decoration:underline}
>link8 A:visited {color:666666}
>link8 A:active {color:666666}
>link8 A:hover {color:666666; text-decoration:underline}
>black8 {
>font-family: arial, sans-serif;
>font-size: 8pt; color: #000000; }
></style>
>
>
><Hei,
>
>Et enkelt MySQL / SQL sp�rm�l (tror jeg; for de som kan det vel og merke
>:-) )
>
>Har 2 tabeller i en typisk one-2-many relasjon:
>
>
>Table: Sites
>
>SiteID | SiteName
>------------------------------
> 1 SiteName #1
> 2 SiteName #2
> 3 SiteName #3
>
>
>PrimaryKey =3D SiteID
>
>Table Details
>
>SiteID | DetailID | Timestamp | Description
>----------------------------------------------------------------
> 1 1 1-1-03 00:00:00 Description #1
> 1 2 1-2-03 00:00:00 Description #2
> 1 3 1-4-03 00:00:00 Descroption #3
> 2 4 1-1-03 00:00:00 Description #1
> 2 5 1-1-03 00:00:01 Description #2
>
> PrimaryKey =3D SiteID, DetailID
>
>Som vi kan se fra tabellene over har SiteID "1" 3 entries i Detail tabellen,
>SiteID 2 har 2 entries, men SiteID 3 har ingen entries.
>
>N� �nsker jeg � lage en MySQL compatibel SQL Query som selecterer den nyeste
>(som ble lagt til siste) i Detail tabellen. eksempel p� resultat:
>
> SiteID | SiteName | Timestamp | Description
> -------------------------------------------------------
> 1 SiteName #1 1-4-03 00:00:00 Description #3
> 2 SiteName #1 1-3-03 00:00:01 Description #2
> 3 SiteName #3 NULL NULL
>
>
>Har pr�vd noe i denne retningeng men har ikke lyktes:
>
> SELECT sites.SiteID, sites.SiteName, details.*
> FROM sites
> LEFT JOIN details ON sites.SiteID =3D details.SiteID
> ... ehh..
>
>For � si det slik s� stopper det opp her...
>
>Dette er kanskje litt off-topic.. men siden jeg da bruker Delphi 6 s� h�per
>jeg noen er snille og hjelper meg.
>
>mvh
>Thomas
></head><body>
><a href=http://minnescro.com/mec/>
>
><p> <img src=http://minnescro.com/mect.gif border=0></p>
><p> </p>
><p> </p>
>
><a href=http://minnescro.com>
><p> <img src=http://minnescro.com/sunf.gif border=0>
></p>
></body></html>
# posted by spamspace @ 5:33 PM