Questions tagged [inline-view]
34 questions
1
vote
1 answer
How to do outer join with inline view (select in from clause) in Postgresql
I have a query similar to this simplified example:
select u.id, sq.score
from usr as u,
(select user_id, score FROM score WHERE bar = ?) as sq
where u.id = sq.user_id
I would like the join (u.id = sq.user_id) to be an outer join. I can't figure…

David Tinker
- 9,383
- 9
- 66
- 98
1
vote
1 answer
Can I use inline views with the criteria API?
Does NHibernate support inline views using criterias? Google doesn't seem to return any relevant results. Here is the query I need to convert preferably using criterias.
SELECT COUNT (incident_count) AS incident_count,
SUM (total_customers)…

Mike
- 4,257
- 3
- 33
- 47
1
vote
1 answer
New to programming: Why can I not alias an inline view in Oracle SQL?
I am new to programming and I am teaching myself ORACLE sql with a textbook from home. I was wondering if anyone could provide me with an explanation for why this script doesn't work. I have been able to do it alternate ways and get the answer but I…

Erek Livingstone
- 11
- 2
1
vote
1 answer
First query data is used in second query
I have a query get_product:
select A.product_id,
A.name, A.description, A.type_id,
B.series_name
product_data A
inner join
series B
on A.series_raw_id = B.series_raw_id
where A.product_id = 503061
and A.registration_type_id = 4
order by…

user2293950
- 39
- 6
1
vote
2 answers
Returning a row from a With clause
I'm trying to make a Function that retruns a value.
In my function I have this script:
WITH t_new AS
(
SELECT PersIDOLD, PersIDNEW, RightsMUT,
SUM(gap) over(ORDER BY PersIDOLD, PersIDNEW) grp
FROM
(
SELECT…

domiSchenk
- 880
- 4
- 23
- 41
1
vote
2 answers
Is there a way to avoid writing inline views more than once in MySQL
Consider a Student table, and a Grades table. Grades table has grades for all the courses that the student took. I want to find the student who has the maximum average grade.
I would have used CTE for this problem, but it seems that MySQL doesn't…

Nitin
- 87
- 12
1
vote
1 answer
SELECTing user with earliest time and joining with other data
I have an Oracle database where I'm trying to select a user field from the earliest row (based on a time field) where certain conditions are met, and I don't know how to do it. Here's the gist of my query:
SELECT id,
CASE WHEN value = 'xyz'
…

Sarah Vessels
- 30,930
- 33
- 155
- 222
0
votes
3 answers
Using Order By with Distinct on a Join (PLSQL)
I have written a join on some tables and I have ordered the data using two levels of ordering - one of which is the primary key of one table.
Now, with this data sorted I want to then exclude any duplicates from my data using an in-line view and the…

TommyWylde
- 1
- 1
0
votes
2 answers
How to Force Oracle to use indexes in inline view of a query with "order by" clause
Oracle 11g
I have a query which schematically looks like this:
select *
from
(
--My inline view
select ...
)
order by
field1, field2;
My inline view is a complicated query from several tables with indexes.
If I execute inline view only,…

Sergey
- 11
- 2
0
votes
2 answers
Need to fix a SQL Query for creating a view
Please use the below temporary table and dataset for reference. Using the below dataset, I am trying to creating a new dataset.
DECLARE @Temp TABLE
(
year_month int,
Vuid int,
Puid int,
ac_cd varchar(20),
sub_ac_cd varchar(20),
jdg_sts…

Arpita Dutta
- 91
- 1
- 1
- 9
0
votes
1 answer
Oracle inline view column alias only working before joining tables and not when joining to tables
I have a query that looks somewhat like this:
select
...,
my_view.alias_name
from
tbl1 join
tbl2 on
tbl1.key = tbl2.key join
tbl3 on
tbl3.key = tbl3.key join
(
select
...,
(max(...) keep (...)) alias_name
…

user7393973
- 2,270
- 1
- 20
- 58
0
votes
1 answer
Oracle Tuning Inline View with group by
I have an overly complex query that contains an inline view with a group by that I wish to try to remove for performance reasons, but I can't seem to think of a way to do so. An overly simplified representation of this query would be:
Select…

Trev
- 23
- 2
0
votes
2 answers
Inline View Qustion
Perhaps someone can assist with designing a query to meet these requirements. I'm going to need this to be part of an inline view which will be joined to a larger query.
I have the basic table of email addresses:
EMAIL
jon@a.com
art@b.com
Then I…

Landon Statis
- 683
- 2
- 10
- 25
0
votes
1 answer
Dynamic bind variables not being recognized in inline view
I have the following code written in SQR:
select
business_unit &g8_iee_business_unit
ledger g8_iee_ledger
sum_posted_total_amt &yb_g8_iee_amount_selected
ft_yb_iee_RPT_NY &g8_iee_rpt_row_ny
currency_cd …

Tom Micua
- 5
- 1
- 4
0
votes
1 answer
Inline view limitations
SELECT in_ev.type, pl.name, in_ev.year
FROM places pl INNER JOIN (SELECT e.type, e.place_id, e.year
FROM events e)in_ev ON in_ev.place_id=pl.place_id
WHERE EXISTS (SELECT 1 FROM in_ev sub_ev WHERE sub_ev.year=1994)
I'm…

tomekn
- 31
- 1
- 5