Skip to content

Tag: sql

Saving with SQL

Hi all I have a page that I’m trying to ADD to a list and save it with viewmodel and SQL. but my list is empty Can you tell me where am I wrong?? on my Xaml (Page1): my Model (Energypage): And on my EnergyViewModel: I did bond my page1 to Energyviewmodel, and it works find when I didn’t use

Create a new column for a table with select data from another table

I have a SQL table that shows the date and time information of a topic. FirstTable looks like this: id DateP TimeP 1 1397/01/02 01:30 2 1398/05/09 05:30 3 1398/06/07 05:10 4 1398/08/09 06:12 5 1399/02/01 07:15 I want to create columns for another table that are the result of selecting the DateP column and the…

TSQL – join two tables with TotalCounter and Pagination

I’m trying to join 2 tables (one to many relation) that include all the columns from first table and only the number of rows from the second one. Use case: one Service has many Reviews. The query looks like: The error is I need to include either average or group by clause but how would that look like I …

how to get start date of latest dept in which working

I’m trying to get the record of emp current working dept with start date Data, in below data Grp column is I’ve derived to get the 3rd last record, which is the correct result. query tried so far Am not able to think ahead, that how can I use Grp now to get 3rd last record as a output. Data

SSMS – get DDL of all views in a schema

I have a SQL Server database with several schemas, each of them contains several views. I need to create the same views in other databases so I would like to get the DDL of all the views in a script, generated through SQL. In Oracle it was quite easy, accessing ALL_VIEWS and referencing the QUERY column. How …

How to aggregate and group by in each column?

I have this table: I’d like to summarize major and minor columns to get this result: Is there any way to achieve this? I tried: But it didn’t count each number. Answer You may achieve this using window functions. major minor major_count minor_count A a 3 2 A b 3 1 B c 2 1 B d 2 1 View