Skip to content

Tag: sql

Order by multiple columns in the SELECT query

How can i order the results in my select query to have them like this? I tried this query but the result is not what I’m looking for: In which col1 represents the first number, col2 is the second one and col3 is the last number in the above example. This query returns: Thanks Answer Sort should be 1-3-2…

MySQL Difficult Where Clause

I need help with a difficult query which I may not explain well with words. The query needs to only return results where all the characters in the code column are in the where clause. Say I had the following table and wanted to return the code and position where ABC. Table: code position ABC 100 ABCD 200 ABCD…

PostgreSQL get results in current time zone

as said in the title I would like to have a query that returns the value of the time stamp in my current time zone (even according summer time!). my_table is: (Don’t ask me why I cannot put this table directly in markdown…prob cause the dates) Now for example if I have to select the 24h correspond…

Why Synapse is not working with my query?

I’m trying to use a query in Synapse Analytics from Azure, and when I use it I got the next error: at Source ‘AgenciesInventoryQueryFromSynapsestg’: shaded.msdataflow.com.microsoft.sqlserver.jdbc.SQLServerException: Parse error at line: 1, column: 47: Incorrect syntax near ‘WITH’…

Show one table that is linked by value to another

I am new to SQL and some points are difficult for me to understand. I have 2 tables: Departments Lectors Departments.head_of_department refers to Lectors.id I need to display lector who is head of department in Department with name X. If it’s possible to select ALL table Lectors and ONLY table Lectors w…