Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Empfohlene Antworten

Veröffentlicht

Also ich hab hier grad ein Brett vorm Kopf...

Mal zur Situation in der Datenbank (ist eine MediaWiki DB)

Es gibt eine Tabelle "cur"

Diese enthält alle Artikel, Kategorien usw.

Die entscheidenden Felder sind:

cur_id, cur_title und cur_namespace

Dann gibt es noch die Tabelle "categorylinks"

Diese enthält die Informationen welcher Artikel oder Kategorie auf welche Kategorie verlinkt

Die entscheidenden Felder sind:

cl_from, cl_to und cl_sortkey

Ich suche nun alle Zeilen, die

cur_namespace=14

haben und

in der categorylinks-tabelle bei

"cl_to" auftauchen, also "cl_to=cur_title"

soweit ja nicht schwer. aber jetzt muss ich prüfen, ob

der artikel mit der id

cl_from

den namespace 0 hat

also

cur_namespace=0

Und dann will ich danach(!), also wenn die zeilen der zweiten bedingung raussind, auch noch eine Limitierung mit Offset-Wert machen.

Kann man das alles in eine SQL packen, oder muss ich dann das zweite mal gesondert prüfen und die Limitierung im Quellcode selber realisieren?

Wenn ich's richtig verstanden habe, dann ungetestet:


 SELECT 

    c1.* 

  FROM 

    categorylinks AS cat 

  LEFT JOIN 

    cur AS c1 

    ON c1.cur_title=cat.cl_to 

  LEFT JOIN 

    cur AS c2 

    ON c2.cur_title=cat.cl_from 

  WHERE 

    c1.cur_id IS NOT NULL 

    AND c1.namespace='14' 

    AND c2.cur_id IS NOT NULL 

    AND c2.namespace='0'

  LIMIT 10

oder

  SELECT 

    c1.* 

  FROM 

    cur AS c1,

    cur AS c2, 

    categorylinks AS cat 

  WHERE 

    c1.cur_namespace='14' 

    AND cat.cl_to=c1.cur_title 

    AND c2.cur_title=cat.cl_from 

    AND c2.cur_namespace='0' 

  LIMIT 10;

ahh danke für die mühe

ein denkanstoß hätte aber auch gereicht

einfach die gleiche tabelle mit zwei aliasen einbinden, gut zu wissen, dass das geht :)

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.