I have a complex (complex because it gave me lots of work to complete!) and it returns results that fulfill the query till the day 30 of the current month. Here is the code: I have a job that runs this query on the third monday of every month. What i need is that the query returns values not only
Tag: select
MySQL select based on earlier row’s data (audit table)
I have an audit table that is structured as follows: This table is tracking whether we were able to successfully source a particular data point for a customer. Sometimes we are able to find the data on the first attempt, and you know this because there was no entry with a status of failed, the first occurrence of a particular
informix 14.10 How to join three table for double mapping
I have 3 tables c1,map1,map2 like this: And the output should be such a table: If it was just table map1, the problem was simple Can anybody help? Answer On the face of it, this should do the job: Tested with this SQL to confirm the result: Output:
SQL frame a result table from a table by searching its field
I have a table as below. MyTabl Name Main Group3 Xyz Group2 Group3 ABC Group1 Group3 PQR – Group3 I need to frame the result table with the fields. “Name”, “…
SQL: create global alias for nested SELECT to be used in another nested SELECT
Let’s assume I’ve got a database with two tables: people which contains person’s id and his/her birth year for each person and parents which contains the (parent_id, child_id) pairs to represent the relative relationships between people. To make the explanation easier let’s assume each person has either 0 children or 1 child. Here is an example of the data in
Select Distinct Top One Record by Date
I am writing a script to compare software between servers but have a many-to-many relational situation to execute this cleanly. I’m thinking a distinct-top by latest date type of query may help. So that I can go from this To this shortened and clean list I am not exactly sure how to approach this? Should I start with a sort,
I cant do a select by one of its parameters even if it exists in the database. Encoding issues? PostgreSQL
I have a postgresql database snapshot with the following structure But it has some weird issues, for example I have this data Some example of data is: Well the problem is now that I do this select 0 returns But if i do It does return the result What is going on? It works with some addresses, but doesn’t with
Selecting values from different columns in rows with the same ID
I have a table called COURSE_SELECT that shows students and which online products they will be able to access, but each product is in a different row, even when each of them has their own column. Table: COURSE_SELECT The vendor needs me to send a CSV file with only one row per student, like this: I have no idea how
SQL many joins many to many
I have 5 tables: Table Reports Many to many table ReportsIpRel Table of InfoProviders Many to many table QueriesIpRel And table of Queries The SELECT I am trying to achieve is the following: I tried many left/inner joins like this: but all for nothing. I have to use where condition: WHERE report_Id = ‘2’ /EXAMPLE I’m trying to do this
Select last N rows with multiple values in a single query
I have a table: messages: < id – title – body – city – street – building – created on > While I was able to select required messages in multiple queries, I need to do it in a single one: Here are my queries at the moment: I need one query because I can then use ORDER BY id