I have a table (MYTABLE) in an Oracle database that has a column which stores a list of items. Something like: ITEM_ID ITEMS 5476301 B, L, M, PP, S, TT 5579504 B, L, M, PP, S, TT 5579504 B, L, PP, S, TT 4005953 L 4064254 L, M 4121291 PP 4162254 M 4189256 M, PP 4255971 M, PP I am
Tag: sql
SQL: Making a conditional WHERE clause?
I’m pretty new to SQL and am struggling to get the syntax/logic correct for what I need. Right now I have a query ending in a where statement: Basically I need all the results, except for data points that have queue = ‘Q1′. For those instances only, I need the results to filter down to where queue_type =’Y’. As the
SQL – how to filter by timestamp looking for anything after a certain time on a previous day
I need to filter a query results to only bring in rows of data that were created after 5pm the previous BUSINESS DAY up until current time, with business day being Monday to friday. I can filter for previous business day, and I can filter by timestamp…but I can’t combine the 2 in order to filter after 5pm previous business
How to structure DBT tables with cyclical dependencies
I have one table containing my members. customer_id name age 1 John 74 2 Sarah 87 Everyday, I get a new table containing the current members. If a new member has joined, I want to add them. If a member has left, I want to nullify their name/id If a current member is still a member then I want to
Not getting proper data while join two query in Mysql
Hi Everyone i am writing a query one query getting weekly data one is getting yesterday record from same table, when i execute both query separatally its working properly but when join both query then yesterday data query not getting proper output. Sampal data https://dbfiddle.uk/?rdbms=mysql_8.0&fiddle=8a678d12df7643000838c2f442d4d85a query 1- weekly data quary-2 yesterday data expected output, driver_id car_number day1_trip day2_trip day3_trip day4_trip
How to using oracle distinct and order siblings by at the same time?
the distinct broken the order siblings by,how can i use them at the same time? such as select distinct * from table xxx starts with … connect by id=pid order siblings by field here is the test sqls executed with different results here is the table Answer You can use ORDER SIBLINGS BY in an inner query and then use
SQL: exclude rows that are duplicates according to some column arrangement
In my problem, I have these rows e.g.: They show pair-wise combinations of ids and names, together with another column c. I consider row 1+2, and 3+4 as duplicates, considering the pairings of ids and names. Rows 1+2, or 3+4 show basically the same information. I had no luck removing the duplicates with grouping, because id1 + id2, or name1
Best way to check if database already exists with flask-sqlalchemy, otherwise create
I have a database app, and want to create the tables and database on the fly when starting the app for the first time. If the app is restarted, it should only create the database and tables if they do not exist, otherwise ignore this creation. I have a few questions. 1.) Is this a proper way of dealing with
Capture string in between
How can I capture data in between a series of strings? I have the following data in a column: Basically, remove all before “INCIDENT TYPE:” and after “External ALARM ID:” “INCIDENT TYPE:” has no specific number of characters. And I only want to display the incident type value Answer Assuming your messages have the fixed format of: we can use
How do I aggregate data in sql for multiple rows of data by column name?
hi im new to sql and trying to understand how to work with data structures. I have a table If the interaction userkey number repeats then, i want a column called number of visits. in this case, for interactionuserkey 5, there are 2 total visits since its repeated twice. for interactionuserkey 0, number of visits =1 and so on. Basically,