I am creating a simple report where I have a location (down to the city level) and some information about that city in regards to my customers. Here is what the table look like Now what I want to …
Tag: sql
How to do like compare on case sensitive string
select http_host,user_agent,date,path, count(*) FROM “public”.”bus_request” where app_name = ‘yyyy’ and event_type ‘browser_js’ and date = GETDATE()-14 and …
Fade in SQL results with jQuery
I have a php file that I have pulling in SQL elements from my database. My goal is that for each row of data that the div ‘moredetails’ would fade in on click (one at a time). However, the current …
How to count the number of orders and the number of returns from same order id?
I’m trying to derive a table as CustomerID, OrderCount and ReturnCount from a table with columns as CustomerID, OrderID, ReturnFlag I’ve tried the following code that gives me 2 distinct tables but I …
(SQLite) Count number of times a value repeats 3 times continuously
I understand that this is a complex query, thus I have a separate column for this, but the column contains almost 99% values as null (which is very ineffecient), thus I want to know it its possible to …
Create an UPDATE statement for every row in a table
I want to update a table on one server with data from a table on another server. The tables have the same columns and I just want to sync the data. I have earlier made a script that creates insert …
Eror While Executing a dynamic queries in a variable
I’m executing a dynamic query from a variable but it always says: Could not find stored procedure I have tried to use simpler queries like set @query = ‘select * from [table_name]’ but it gives the same error. In my temporary table is the list of all my trigger name so the expected output I …
How do you put a conditional statement inside of a SQL count?
I have some entries where the join date and transaction dates are the same, so I want to include a condition excluding if the count is zero (divide by zero case). I was wondering if I could include …
Given a long/lat, convert meters into longitude/latitude degrees
I have a longitude and latitude stored as a geometry with SRID 4326. I want to make a line that is exactly 1000 meters long that is 90 degrees (to the right). I know that the conversion from a …
Is there a SQL syntax that will create new column by searching in 2 columns based on equal value of 3rd column in same table?
I have 1 table, with fields named: class_code, name1, class_code1, name2, class_code2. I would like to search the value of class_code, and display it as class_code and name only, where class_code = …