Skip to content

Use smaller than on like clause

I have some number like These numbers are only an example I have a lot of 14… a lot of 15… etc. Now in WHERE clause of a stored procedure, I want to exclude all numbers who start with 15 or less so I can do something like: Is there a way to change this and use something like TestColumn

SQL GROUP BY where partitions meet condition

Consider following table: I want to group by var_a in such a way, that each group would have in it var_b = ‘123’ and var_b = ‘456’. That is, I want to obtain “abcd” and “ijkl” in the set of results. How do I do that? Answer You can filter the table and group by …

SQL IF statements in transactions

I’m trying to make a condition where if the number of available seats within a given plane is less than zero then ROLLBACK. However, I am receiving a message stating that there is a syntax error at IF (i.e. “syntax error at or near “IF””). Why is this, can I not use if statements…

Was column ever equal to x in sql

I have a dataset that looks similar to this: I want to check if the description was ever equal to X, grouped by unique ref. I would also like it to have a separate column for the date in which description was X. If the unique ref has been X more than once then the date would be the most