(7)
sql sorusu (3 tablo joinlerken son tabloyu filtreleme)
merhaba bu şekilde 3 tabloyu joinledim:select su.id as subscription_idfrom subscription.Subscription sujoin subscription.Plan pl on su.planId = pl.id and pl.serviceId = 3join miro.BasePayment on miro.BasePayment.organisationId = su.organisationIdson satırdaki miro.Basepayment tablosunu da filtreleme
merhaba bu şekilde 3 tabloyu joinledim:
select su.id as subscription_id
from subscription.Subscription su
join subscription.Plan pl on su.planId = pl.id and pl.serviceId = 3
join miro.BasePayment on miro.BasePayment.organisationId = su.organisationId
son satırdaki miro.Basepayment tablosunu da filtrelemek istiyorum signedDate kolonu not null olanları getirsin ve id kolonunda da 4 ve 7 ile başlayan id'leri getirmesin (not in 4 7 gibi) istiyorum bu sorgu üzerinde nasıl yapabilirim bunu? deniyorum ama olmadı yeni öğreniyorum sql yardımcı olursanız çok makbule geçecek
0
Where kullandığında ne oluyor?
- WHERE miro.BasePayment.signedDate IS NOT NULL AND LEFT(miro.BasePayment.id, 1) NOT IN (4,7)
0
atom karincanin torunu
(
28.07.20)
@atom karınca
error vermedi ama hiçbir şey de çıkmadı altta, ilk kısım işe yarıyor ama and'den sonrası olmadı. çok teşekkür ederim.
0
şuna çevirdim
where miro.BasePayment.signedDate IS NOT NULL and miro.BasePayment.id not in (4,7)
şuan oldu gibi.
0
LEFT fonksiyonunu yanlış kullanmış olabilirim ayrıntıları hatırlamıyorum, bu tip durumlarda sorgunu parçalayıp test etmek iyi olur, mesela;
SELECT * FROM miro.BasePayment WHERE LEFT(miro.BasePayment.id, 1) NOT IN (4,7)
Bunu alıp doğru sonuç elde edene kadar düzenle, mesela left'ten önce (INTEGER) yazmak işe yarayabilir belki.
0
atom karincanin torunu
(
28.07.20)
select su.id as subscription_id
from subscription.Subscription su
join subscription.Plan pl on su.planId = pl.id and pl.serviceId = 3
right join miro.BasePayment on su.organisationId = miro.BasePayment.organisationId and miro.signedDate is not null and miro.id not in(4,7)
0
oldu şimdi çok teşekkür ederim harikasınız
0
4 ve 7 ile başlayanlar id'ler gelmesin demişsiniz. not in(4,7) kısıtı 4 ve 7 yi getirmez sadece. 41,7654 gibi id'ler gelir.
tabloda şu an 39'dan büyük id yoksa farkı fark etmezsiniz.
0