[Solved] How do display top 5 products from specific category [closed]

First, let’s define what we need. We need a table (view) with these fields: ProductId, ProductName, ProductViewCount, and RootCategoryId. Imagine, the Category table has RootCategoryId field already. Then we can use this query to receive the result: SELECT P.Id AS ‘ProductId’, P.Name AS ‘ProductName’, PVC.ProductViewCount, C.RootCategoryId FROM Category C INNER JOIN ProductCategory PC ON PC.CategoryId … Read more

[Solved] How to insert byte[] array with ORMlite into image column

In ServiceStack.OrmLite v4, as specified by mythz in the comments, everything should work as-is. In v3, if you want to have byte arrays serialized as binary instead of base 64 strings, you should inherit from SqliteOrmLiteDialectProvider and override the functions responsible for converting CLR values from and to SQL values to handle byte arrays. public … Read more

[Solved] T-SQL to generate expect result

Assuming that I understand the problem: you have a number of rows with sections (“Cates”) and symbols (“Type”); if there are any symbols ending in a minus sign then these indicate a row without a minus sign should be removed; symbols are never “mixed” per section, i.e. a section can never have “A” and “B-“; … Read more

[Solved] select yesterday date in where condition

SELECT * FROM yourTable WHERE (FilteredPhoneCall.createdon >= dateadd(day,datediff(day,1,GETDATE()),0) AND FilteredPhoneCall.createdon < dateadd(day,datediff(day,0,GETDATE()),0)) OR (FilteredPhoneCall.modifiedon >= dateadd(day,datediff(day,1,GETDATE()),0) AND FilteredPhoneCall.modifiedon < dateadd(day,datediff(day,0,GETDATE()),0)) solved select yesterday date in where condition