I have a database file that looks like the following: When I put this in a SQL Datasource (Visual Studio), the file should be clickable text or image. Now it’s just plain text. What I currently have is: But this links to link instead of the content of the sql. Thanks Answer Remember, code behind can use…
Tag: sql
SQL: Use LEAD() and PARTITION BY to access to the next row following the current row
I have a mobile app browsing history dataset as shown below. DeviceDateTime: Date and Time the User views the page in the mobile app. UserID: each UserID represents a visitor who login the mobile app. PageName: There are different pages in the Mobile App. All visitors would first land on the Home page, and th…
Formatting the surrogate key based on other columns
I have a table in SQL Server I want my registerNumber to be of type batch+branch+id eg a row in student id:1, batch:17, branch:BIT then the registerNumber should be 17BIT1 I tried to do this by using a default value in create table but it does not allow me to reference the columns of the same table edit thank…
How to select all data corresponding to the 3 latest dates for each ID?
I would like to see all the data (all columns) related to the last 3 dates of an ID The result would be in this case: Could you please help me? Answer You can use window functions:
Nested SQL AND OR Statement fails. Where is my mistake? [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed last year. Improve this question I wanna get the data set where either latitude is between x and y value OR where adress is equ…
Partition By Logic
I have a dataset that has roughly 1 million rows. Without hard coding any claims, what would be the way to get the resulting output? From my research I determined something like DENSE_RANK or ROW_NUMBER() with a partition expression should do the trick.Is there a way to use DENSE_RANK to say “go down th…
Display both values of same column after comparing rows (with inner join)
When you perform an inner join to compare 2 values of the same column, but different rows, with eachother. How do you include both compared values of the same column? Without error “column specified more than once” In the new table I want to see a.var2 and b.var2. Answer You need alias names for t…
Filter out specific value without excluding the NULL rows
I have the following table and I want to filter out a specific value but keeping the null (empty) rows. I tried different ways but the query kept filtering out the null rows. For example, I only want to filter out the rows with the orange, the output table should be: I also tried with OR All of the returned
SQL field does not have a default value – Even though field is set to default NULL
I have an older SQL database that I am trying to use, I am not sure of the version it was originally built for but I am trying to use it with Maria 10.2 table1 looks like this… And I am trying to write a firstname to it with a prepared statement like this… I am getting an SQL error…..
Data type for SQL aggregate functions (COUNT, SUM, AVG)
New to SQL. Say I run this query: This will return a single row with a field called “TotalSuppliers”. In my database, the result was “778”. When tested in C# using typeof, the type for this field was short (the ODBC SMALLINT or OleDB SmallInt data type). This matched the data type of t…