Nested kategorileri listeleme.

95 views
Skip to first unread message

MUSTAFA SİNAN KOCA

unread,
Sep 23, 2015, 8:40:20 AM9/23/15
to altdotnetturkiye
Merhaba Arkadaşlar,
sonsuz kategori mantığında kategorilerimi yaptım, fakat şunu istiyorum id si 1 olan ana kategorinin en alt kategorisi olan id 6 olan kategoriye kadar olan kısımdaki tüm kategori id lerini almak, bunu şundan dolayı yapmak istiyorum oldu ki id si 1 olan elektronik kategorisini sildim  ona bağlı olan tüm alt kategorileri silmek istiyorum. Bunu nasıl yapabilirim ? Belkide çok basit ama 3 gündür çıkamadım işin içinden. c# ile yapıyorum projemi.
Örn:

kategoriid kategoriadi ustkategori
1          elektronik 0
2          mobilya 0
3          ofis elektroniği1
 4          telefon 3
5          cep telefonu 4
6          desk telefon 4

Harun LEGOZ

unread,
Sep 23, 2015, 9:48:35 AM9/23/15
to altdotne...@googlegroups.com

Veritabanin sql server ise Common Table Expressions adında bir sorgu turu var, hiyerarşik ve recursive sorgular atabiliyorsun, gayet de hızlı.

https://technet.microsoft.com/en-us/library/ms186243(v=sql.105).aspx

--
You received this message because you are subscribed to the Google Groups "altdotnetturkiye" group.
To unsubscribe from this group and stop receiving emails from it, send an email to altdotnetturki...@googlegroups.com.
To post to this group, send email to altdotne...@googlegroups.com.
Visit this group at http://groups.google.com/group/altdotnetturkiye.
For more options, visit https://groups.google.com/d/optout.

Burak Sarıca

unread,
Sep 24, 2015, 12:45:34 PM9/24/15
to altdotne...@googlegroups.com
Eğer Oracle ise iş daha da kolay


iPhone'umdan gönderildi

23 Eyl 2015 tarihinde 16:48 saatinde, Harun LEGOZ <hyl...@gmail.com> şunları yazdı:

Sidar Ok

unread,
Sep 24, 2015, 12:56:05 PM9/24/15
to Altdotnetturkiye
Veri tabanin her ne olursa olsun normalizasyonla sorununu cozebilirsin.

Kategori bilgileri ile kategori iliskileri tablolarini ayir.

Ana Kategori Tablous: KategoriId - KategoriAdi
Iliskiler Tablosu: IliskiId - UstKategoriId - KategoriId

2. tablodan 1. tabloya UstKategoriId ile bir cascade koyarsin, db seviyesinde otomatik hallolur.

Reply all
Reply to author
Forward
0 new messages