I am working on Bus route management system , I made two table first one is Cities and second one is route have following queries i am joining the table through inner join but it show single column as but i want result as what is possible way to do this using inner join Answer I suspect you need something
Tag: sql
Invalid object name ‘sys.dm_exec_input_buffer’
I’m trying to start a script in SQL Server 2014, but it can’t find the object in question. This is the query I am trying to initiate: Error message: Msg 208, Level 16, State 1, Line 1 Invalid object name ‘sys.dm_exec_input_buffer’. Answer You need to be on at least Service Pack 2. If y…
Slow SQL Query / Displaying (PHP / jQuery)
I have a request to get data in my mySQL database (36,848 entries). Then I format and append them with jQuery on my web page. These two operations take 2 minutes and 30 seconds. During this time, no other operation is possible on the page. Is there a way to optimize this to speed up the process? Like this, it…
WITH queries with INSERT in MySQL
I’m trying to do something that I’m almost positive works in Postgresql: In other words, I want to grab the “something” row to be used for a bunch of new rows in “somwhere”. Each new entry should have a reference (like foreign key value) back to the same “something…
Mongodb for projects with many to many relationships
I’m at the beginning of starting a project for learning backend development with a bit of frontend development. For that, I wanted to create a project around cooking recipes. The plan was to create an admin REST API that would be later used by a custom CMS to create, edit, delete,… recipes and a p…
SQL GROUP BY and HAVING but have results include column not included in GROUP BY to provide more detail?
Sample data: Week Client Amount 1 A 20 1 B 20 2 A 20 2 B 10 3 C 40 I want a query where if the total for the week is 40 or more, include those rows in the result set, but ALSO include the Client. So the results would look something like this: Week Client Amount 1 A
SQLServer – Is it possible to divide the results of the same column?
I have a table containing the input and output parameters of different APIs. Here is the structure of my database : The only way to differentiate if a parameter is input or output is the type. If the type is NULL ? It is an output parameter. So, I would like to know if it is possible in a simple
grouping equal values – aggregate function problem
I’ve created a table that lists venues in which several events take place. The same event in the same venue can have a different price. The last column calculates the total revenue for one venue. venue event totalprice sum Venue A Event A 5 30 Venue A Event A 10 30 Venue A Event B 5 30 Venue A Event
Postgres duplicate column based on value in column
I’ve the following table in postgresql id product customer price amount 1 Television Alfred 12.00 1 2 Radio Richard 20.00 3 3 Mobile Richard 40.00 5 Is there some way via SQL to duplicate the line n-times in case the amount is greater than one? This is how the table should look like after running the qu…
Microsoft SQL Server Streak Counter
I have data in the following format: ID Period Date 1 1 2020-09-05 1 2 2020-10-01 1 3 2020-10-30 2 2 2020-10-01 2 4 2020-12-05 2 6 2021-02-05 3 1 2020-09-05 I want to calculate a streak grouping by both ID and period. The first date instance for each group should start at one, and if the date in the