Skip to content
Advertisement

How to make a query that filter out two AND conditions on same column

Write a query that returns all pages that have been visited by at least one child (demo=’child’) and ALSO has been visited by at least one person aged 18-25 (demo=’18-25′). Your query should return a set of urls. I am not sure how to write a query that filters out results based on Two AND statements on the same column

How to convert SQL statement to Power BI DAX?

I have no idea how to recreate the following code from SQL to DAX in Power BI: Or perhaps there is a way to operate on SQL commands in Power BI with imported and filtered tables? I want to do the SQL query on the already sliced data in Power BI. Thank you in advance 🙂 Answer You can achieve

SQL MAX on primary key, is filter condition unncessary if it is already indexed?

id is the primary key. Is date(created_at) = ‘2021-11-05′ and time(created_at) > TIME(’04:00:00’) filter condition unnecessary for Max function since studenthistory is already indexed on class_id and student_id? The only reason I added that datetime filter is because this table will get huge over time. (historical data) And I wanted to reduce the number of rows the query has to

What does SELECT followed by a SQL command as a string mean

What does something like mean? I know usually you have the column name after the select, like SELECT first_name, but what does it mean when it is in single quotes? I believe the || means to concatenate the strings. Sorry, I’m new to this and couldn’t seem to find anything about this. EDIT: Sorry I realized my question was not

Why doesn’t the WHERE work in this sql query

I’m writing a SQL query that needs to only show the results where the ‘titel’ is the same as ‘Baklava’, but it doesn’t return any rows. When I try to use the query without the WHERE, is shows all the results, but I need the WHERE clause to work. Here is the query I’m trying to use: import.sql: Answer You

Conditional where clause in Oracle SQL query is not working

I am trying to do a select on Oracle DB with this condition but it is not working. Table POST but when endDate is null I got the error Please help Answer The solution was to transform the Date in String, and in the select do this and (:endDate is null or pl.date_end <= TO_DATE(:endDate , ‘yyyy-MM-dd HH:MI:SS’))

How to merge two array if one item exist in both array?

I want to expand my city array with post code value. If the city_postcode array contain city array name record then push postcode value into city array. That’s what i want to achive somehow. city array: city_postcode array: The result I want: Answer If you can rely on the cities and post codes to be equal in length and sorted,

How to merge recordsets with different fields

In SQL, union can be used to append the rows of a recordset (table or query) to another one with the same fields. You can also append recordsets with different fields by combining the fields of both …

Advertisement