Skip to content

Tag: select

mysql get result from join table

I have a tables person and exam. I want to show data where all exam is PASS, show the latest exam pass_date. like table below what query to get it? please help. thanks! Answer You can use aggregation and conditional expressions: Note that for this sample data, you don’t need to bring in the person table…

How to use select statements for column name ending in +

I am attempting to run a spearman correlation on some data under the column name solar+. However, when attempting to use select statements to select the desired number of rows from the egauge13830 table, the plus sign is considered an operator and causes an error. These are the 2 statements I’ve tried a…

SQL query NOT EXIST very slow

I’m trying to optimize an SQL query as it is slow, and gets slower when the query result is high. There are indexes concerned fields and Tables are quite big. Answer As a starter, this condition: Should be rewritten as: This is functionally equivalent, and not using date functions on the column being fi…