Urvalsfrågor

Urvalsfrågor
Lär dig hur du använder Mobigos urvalsfrågor för att snabbt och enkelt sortera fram den information du behöver.

Här nedan finner ni ett gäng urvalsfrågor som man kan ha användning av:

Uppdrag

Kund med telefonnr

SQL:

[CustomerNr] IN (SELECT DISTINCT [Nr] FROM [tblCustomer] WHERE [Phone]='%{Telefonnr}%')
Tillhör Avtal

SQL:

[tblTask].[Id] IN ( SELECT [tblContractTask].[TaskId] FROM [tblContractTask],[tblContract] WHERE [tblContractTask].[ContractId]=[tblContract].[Id] AND [tblContract].[ContractNr]='{Nummer}' )

Parameter:

SELECT DISTINCT [ContractNr]+' ('+[CustomerName]+')'+'|'+[ContractNr],[ContractNr] FROM [tblContract] WHERE [Status]<>2 ORDER BY [ContractNr]
Innehåller material (Artnr)

SQL:

[Id] IN (SELECT DISTINCT [OwnerId] FROM [tblMaterial] WHERE [ArtNr]='{Artnr}' AND [OwnerType]=2)

Parameter:

SELECT DISTINCT [tblMaterial].[ArtNr] FROM tblTask INNER JOIN tblMaterial ON [tblTask].[Id] = [tblMaterial].[OwnerId] AND [tblMaterial].[OwnerType]=2 ORDER BY [tblMaterial].[ArtNr]
Innehåller material (Benämning)

SQL:

[Id] IN (SELECT DISTINCT [OwnerId] FROM [tblMaterial] WHERE [ArtName]='%{Benämning}%' AND [OwnerType]=2)

Parameter:

SELECT DISTINCT [tblMaterial].[ArtName] FROM tblTask INNER JOIN tblMaterial ON [tblTask].[Id] = [tblMaterial].[OwnerId] ORDER BY [tblMaterial].[ArtName]
Användare

SQL:

[ID] IN (SELECT [Id] FROM tblTask WHERE ';' + UserSign + ';' LIKE '%;;%')

Parameter:

SELECT DISTINCT [Sign] FROM [tblUsers] ORDER BY [Sign]
Dagens (KÖ) uppdrag

SQL:

UserSign = '(KÖ)' AND PlanStartDate < DATEADD(D, 1, DATEDIFF(D, 0, GETDATE())) AND PlanStartDate >= DATEADD(D, 0, DATEDIFF(D, 0, GETDATE()))

Parameter:

Kunder

Med kontaktperson

SQL:

Id IN (SELECT CustomerId FROM [tblCustomerRef] WHERE Name LIKE '%{Namn}%')

Parameter:

SELECT DISTINCT Name FROM tblCustomerref ORDER BY NAME
Med värde i extrafält

SQL:

[Id] IN ( SELECT [OwnerId] FROM [tblExtraFieldData] WHERE [FieldId]=(SELECT Id FROM tblExtraFieldDef WHERE Name = '{Fält}' AND OwnerType = 3 ))

Parameter:

SELECT [Name] FROM [tblExtraFieldDef] WHERE [OwnerType]=3
Som köpt artikeln

SQL:

Nr in (SELECT [CustomerNr] FROM tblTask, tblMaterial WHERE [tblMaterial].[ArtNr]='{Artikelnr}' AND tblTask.Id=tblMaterial.OwnerId AND tblmaterial.ownertype = 2)

Parameter:

SELECT DISTINCT [ArtNr] FROM [tblMaterial] ORDER BY [ArtNr]