Merhaba Hazirladigim bir wiev e üç kolon eklemek istiyorum bu kolon stharda asagidaki kosullari saglayan son net giris fiyatini bulacak buradan yaptigimiz satilsin net karini ve yüzdesini bulacak
kosul söyle : kisit olarak verdigim sube kodu içinde olan ve verdigim tarih araliginin en üst sinirindan geriye dogru son net giris fiyatini bulacak
simdiden tesekkür ederim.
HAZIRLADIGIM wiev :
uses xxx
GO /****** Object: View [dbo].[AYLI_SATISLAR] Script Date: 05/14/2008 11:26:47 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE VIEW [dbo].[AYLI_SATISLAR] AS SELECT dbo.TBLSTSABIT.STOK_ADI, dbo.TBLSTHAR.STOK_KODU, dbo.TBLSTHAR.FISNO, dbo.TBLSTHAR.CEVRIM, dbo.TBLSTHAR.STHAR_GCKOD, dbo.TBLSTHAR.STHAR_TARIH, dbo.TBLSTHAR.STHAR_NF, dbo.TBLSTHAR.STHAR_BF, dbo.TBLSTHAR.STHAR_IAF, dbo.TBLSTHAR.STHAR_KDV, dbo.TBLSTHAR.DEPO_KODU, dbo.TBLSTHAR.STHAR_ACIKLAMA, dbo.TBLSTHAR.STHAR_SATISK, dbo.TBLSTHAR.STHAR_MALFISK, dbo.TBLSTHAR.STHAR_FTIRSIP, dbo.TBLSTHAR.STHAR_SATISK2, dbo.TBLSTHAR.LISTE_FIAT, dbo.TBLSTHAR.STHAR_HTUR, dbo.TBLSTHAR.STHAR_DOVTIP, dbo.TBLSTHAR.STHAR_DOVFIAT, dbo.TBLSTHAR.STHAR_ODEGUN, dbo.TBLSTHAR.STRA_SATISK3, dbo.TBLSTHAR.STRA_SATISK4, dbo.TBLSTHAR.STRA_SATISK5, dbo.TBLSTHAR.STRA_SATISK6, dbo.TBLSTHAR.STHAR_BGTIP, dbo.TBLSTHAR.STHAR_KOD1, dbo.TBLSTHAR.STHAR_KOD2, dbo.TBLSTHAR.STHAR_SIPNUM, dbo.TBLSTHAR.STHAR_CARIKOD, dbo.TBLSTHAR.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IHI, dbo.TBLSTHAR.ONAYTIPI, dbo.TBLSTHAR.ONAYNUM, dbo.TBLSTHAR.KKMALF, dbo.TBLSTHAR.STRA_IRSKONT, dbo.TBLSTHAR.YAPKOD, dbo.TBLSTHAR.STHAR_CARIKOD AS Expr2, CASE WHEN sthar_gckod = 'c' THEN sthar_gcmik ELSE 0 END AS CIKIS, CASE WHEN sthar_gckod = 'G' THEN sthar_gcmik ELSE 0 END AS GIRIS, dbo.TBLSTSABIT.GRUP_KODU, CASE WHEN sthar_gckod = 'C' THEN STHAR_GCMIK * STHAR_NF ELSE 0 END AS CIK_TUTAR, CASE WHEN sthar_gckod = 'G' THEN STHAR_GCMIK * STHAR_NF ELSE 0 END AS GIR_TUTAR, dbo.TBLSTHAR.STHAR_GCMIK2, dbo.TBLSTHAR.STHAR_GCMIK, dbo.TBLSTGRUP.GRUP_ISIM FROM dbo.TBLSTHAR INNER JOIN dbo.TBLSTSABIT ON dbo.TBLSTHAR.STOK_KODU = dbo.TBLSTSABIT.STOK_KODU INNER JOIN dbo.TBLSTGRUP ON dbo.TBLSTSABIT.GRUP_KODU = dbo.TBLSTGRUP.GRUP_KOD WHERE (dbo.TBLSTHAR.STHAR_CARIKOD <> '000000000000000')
GO EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00] Begin DesignProperties = Begin PaneConfigurations = Begin PaneConfiguration = 0 NumPanes = 4 Configuration = "(H (1[27] 4[31] 2[16] 3) )" End Begin PaneConfiguration = 1 NumPanes = 3 Configuration = "(H (1 [50] 4 [25] 3))" End Begin PaneConfiguration = 2 NumPanes = 3 Configuration = "(H (1 [50] 2 [25] 3))" End Begin PaneConfiguration = 3 NumPanes = 3 Configuration = "(H (4 [30] 2 [40] 3))" End Begin PaneConfiguration = 4 NumPanes = 2 Configuration = "(H (1 [56] 3))" End Begin PaneConfiguration = 5 NumPanes = 2 Configuration = "(H (2 [66] 3))" End Begin PaneConfiguration = 6 NumPanes = 2 Configuration = "(H (4 [50] 3))" End Begin PaneConfiguration = 7 NumPanes = 1 Configuration = "(V (3))" End Begin PaneConfiguration = 8 NumPanes = 3 Configuration = "(H (1[56] 4[18] 2) )" End Begin PaneConfiguration = 9 NumPanes = 2 Configuration = "(H (1 [75] 4))" End Begin PaneConfiguration = 10 NumPanes = 2 Configuration = "(H (1[66] 2) )" End Begin PaneConfiguration = 11 NumPanes = 2 Configuration = "(H (4 [60] 2))" End Begin PaneConfiguration = 12 NumPanes = 1 Configuration = "(H (1) )" End Begin PaneConfiguration = 13 NumPanes = 1 Configuration = "(V (4))" End Begin PaneConfiguration = 14 NumPanes = 1 Configuration = "(V (2))" End ActivePaneConfig = 0 End Begin DiagramPane = Begin Origin = Top = 0 Left = 0 End Begin Tables = Begin Table = "TBLSTHAR" Begin Extent = Top = 6 Left = 38 Bottom = 151 Right = 215 End DisplayFlags = 280 TopColumn = 0 End Begin Table = "TBLSTSABIT" Begin Extent = Top = 6 Left = 253 Bottom = 114 Right = 473 End DisplayFlags = 280 TopColumn = 3 End Begin Table = "TBLSTGRUP" Begin Extent = Top = 6 Left = 511 Bottom = 114 Right = 693 End DisplayFlags = 280 TopColumn = 0 End End End Begin SQLPane = End Begin DataPane = Begin ParameterDefaults = "" End Begin ColumnWidths = 92 Width = 284 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 ' ,@level0type=N'SCHEMA', @level0name=N'dbo', @level1type=N'VIEW', @level1name=N'AYLI_SATISLAR'
GO EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane2', @value=N' Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 End End Begin CriteriaPane = Begin ColumnWidths = 11 Column = 6450 Alias = 1395 Table = 1170 Output = 720 Append = 1400 NewValue = 1170 SortType = 1350 SortOrder = 1410 GroupBy = 1350 Filter = 1350 Or = 1350 Or = 1350 Or = 1350 End End End ' ,@level0type=N'SCHEMA', @level0name=N'dbo', @level1type=N'VIEW', @level1name=N'AYLI_SATISLAR'
GO EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=2 ,@level0type=N'SCHEMA', @level0name=N'dbo', @level1type=N'VIEW', @level1name=N'AYLI_SATISLAR'
|