Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Empfohlene Antworten

Veröffentlicht

Hi Leute,

ich hab folgenden Sql Query:

  

  select * from [Bla].[dbo].[InventoryDeviceUser]

  where [DeviceUserID] in (

  select  MAX([DeviceUserID]) as ID

  from [Bla].[dbo].[InventoryDeviceUser]

  group by DeviceID  )

und will den in Linq schreiben.

bekomm das aber irgendwie nicht hin.

soetwas wie Max gibts in Linq nicht..

(Die abfrage soll bewirken dass ich auf die DeviceUserID gruppiere und immer den neuesten eintrag will.)

Wär cool wenn jemand helfen könnte..

Danke schonmal

Murphy

  • Autor

naja im prinzip is mein Ansatz so wie in SQL nur dass ich dann hängen bleib :D


from d in  context.InventoryDeviceUsers

                                                where (from m in context.InventoryDeviceUsers select  m.DeviceID /*Game Over  */ ).Contains(d.DeviceID);[/code]

Okay, und wie verwende ich das dann in diesem fall?

  • Autor

Danke,

ich hab jetzt schon ne lösung gefunden:


                var lastDeviceUserIDs = from entry in context.InventoryDeviceUsers

                                        group entry by entry.DeviceID into g

                                        select g.Max(d => d.DeviceUserID);


                gcOnlineScanners.ItemsSource = from idu in context.InventoryDeviceUsers

                                               where lastDeviceUserIDs.Contains(idu.DeviceUserID)

                                               select idu; 

klappt so wunderbar..

trotzdem danke an euch :)

Murphy

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.