I’m actually trying to have a number of time that a driver visited a town. I’m close to have the good result, but I need a little bit help to achieve this. So here it is my database TABLE_NAME …
How to help implement more logic in my joins?
I have some logic currently in my sql statement that takes away all punctuation so I can compare the two fields easily; however, I am having an issue now where my A table has a bank name of BBVA …
Query that detects difference between accounts/loads from TODAY and YESTERDAY
GOAL: DETECT any difference between yesterday’s table loads and today’s loads. Each load loads values of data that are associated with bank accounts. So I need a query that returns each individual …
Getting JSON Array elements as records
I’m trying to extract elements from a simple JSON array in a PostgreSQL table like: id(int) vtags(jsonb) ——– ———————– 1 {“tags”: [“a”,”b”,”c”]} 2 {“tags”: [“x”,”…
How can I select an ID from the row with the maximum value for each of several columns?
I want to extract the values of an ID column from the rows containing the maximum values of each of several other columns, and then collate these in a new table which has the column headers in one …
Pivot on Spark dataframe returns unexpected nulls on only one of several columns
I’ve pivoted a Spark dataframe, which works correctly for all columns except one, even though they’re all almost exactly the same. I have a dataframe which looks like this: (there are 29 distinct cf_id values, but in this example only two) when I run: I’d expect to see: All columns work corr…
SQL: Add some validation steps for phone number
I have a fairly simple bit of SQL code that’s truncating three fields into one called “phone_number”: Select pp.country_code_number||pp.area_code||pp.phone_number AS phone_number What I’d like …
How to select MAX from AVG?
I’m practicing for my SQL exam and I can’t figure out the following question: “Of the average amount paid per customer, show the highest amount.” So to retrieve the average amount paid, I would do the following: Then I would like to retrieve the highest average amount out of this list …
Why does my button not pass the Order ID onto another page?
I have a page called order_page.php and it has a hyperlink that should pass the Order ID of a particular order to another page called edit.php. I looked up some tutorials on youtube but it’s still …
Join the records with sql?
I have a table with those 5 rows. code | type_id | status —–+——–+——– 123 | 123456 | DONE 123 | 456789 | DONE 321 | 654321 | DONE 321 | 897321 | DONE 456 | 999888 | DONE 456 | …