Skip to content

Tag: sql

Member’s books in possession in Library System

Hello I am currently working into a library system and I do want to view how many books are in possession of a specific member. I want to add a copies to student whenever I issue a book to them. I have tried: but it doesn’t insert into members row, instead it shows I have also tried: But doesn’t w…

SQL Recursive Count

I have two tables I am joining with the following structure: A ContentDivider can have n ContentDividers as Children and can have m CustomPages as children as well. I want a View that counts the Display the current CustomDivider and the COunt for all the CustomPages as Children of the current ContentDivider. …

SELECT to return duplicate distinct column values

Tying to have query that can duplicate some column values based off values in other columns. ID1 column will always have a value and ID2 and ID3 may or may not. Data in table looks like this. Wanting to to query this table to show resultset like this Been stabbing at this trying case selects, and inserting in…

How can I join result from two queries

So sorry but I am new to SQL querying and could use a little help. I will like to join results from 2 tables and I can’t seem to get it return results I need. Query 1 Query 2 I tried using union all but I get an error must have equal number of expressions in their target lists. Any

Replace function in SQL Server

I have a string of data I am trying to use the replace function to replace double commas with NULL values Solution But I keep ending up with (The ,,, needs to become ,NULL,NULL, but only becomes ,NULL,,) Here is my sample code I’m using Answer If you do the same replacement twice, any number of sequenti…