تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
[SQL] ارجو تحويل الكود الى sql
#1
select tabel1.name1,tabel1.txt, tabel1.id, sum(iif (test1.teep=1,test1.mony, 0)) as ouut, sum(iif (test1.teep=0,test1.mony, 0))as book,iif(book-ouut>0,book-ouut,(book-ouut)*-1) as good,iif(book-ouut>0,'no','yas') as video from tabel1 inner join test1 on tabel1.id = test1.id where 1=1 group by tabel1.name1,tabel1.txt, tabel1.id
الرد }}}
تم الشكر بواسطة:
#2
إذا كنت متأكد من ان نتيجة الاستعلام صحيحة 100% كل ماعليك فعله هو الاتي :

PHP كود :
/* اسم قاعدة البيانات */
USE [DATABASE_NAME]
GO
/****** Object:  View [dbo].[View_1]    Script Date: 11/24/2019 7:58:15 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/* اضافة هذا السطر قبل الاستعلام */
CREATE VIEW [dbo].[View_1]
AS
/* هذا استعلامك */
select tabel1.name1,tabel1.txttabel1.idsum(iif (test1.teep=1,test1.mony0)) as ouutsum(iif (test1.teep=0,test1.mony0))as book,iif(book-ouut>0,book-ouut,(book-ouut)*-1) as good,iif(book-ouut>0,'no','yas') as video from tabel1 inner join test1 on tabel1.id test1.id where 1=1 group by tabel1.name1,tabel1.txttabel1.id
/* تنفيذ الاستعلام عن طريق الضغط على زر Exccute */
GO 
الرد }}}
تم الشكر بواسطة: محمد كريّم



التنقل السريع :


يقوم بقرائة الموضوع: