Questions tagged [inner-query]

79 questions
0
votes
0 answers

.net core Entity Framework The nested query is not supported. Operation1='Case' Operation2='Collect'

I have a following query for some nested implementation return _context.baseTable1.Where(h => h.id == Id ).Select(lev => new { Contact = (lev.baseTable2 != null &&…
Kamran Shahid
  • 3,954
  • 5
  • 48
  • 93
0
votes
2 answers

How to sort column value in mysql when results are grouped

I have three database tables projects which contains data about projects Table "project": project_id name 10000 Project 1 20000 Project 2 30000 Project 3 40000 Project 4 Table…
0
votes
0 answers

Is there a step in Pentaho Spoon to use a transformation as inner query?

Transformation example Is there a way for me to use a transformation like this to use as an inner query in 'table input 4' like using 'insert data from the step' or 'execute sql script'? If not, is my only option using the whole query in the table…
0
votes
2 answers

How to compare a date from outer query with date in inner query using MYSQL?

I have customers, jobs, orders and dates as columns. Customers can have multiple orders per job and of course multiple jobs given a certain date range. What I am trying to do is figure out how many "new" orders there are within a certain date…
Zackattack
  • 316
  • 1
  • 7
0
votes
1 answer

Apply distinct on one column and order by on another with count

In MySql DB I have CustomerId productId modelNumber CAnWgsN0 C9407R 300 CAnWgsN0 C5861W 300 CAnWgsN0 C9407R 400 CAnWgsN0 C5861W 600 CAnWgsN0 C9407R 300 …
0
votes
1 answer

How do I handle exception while converting date

I have a Sales table and a Period table. Sales table +--------------+-------------+ | Country_Code | Period_Code | +--------------+-------------+ | CH | MAI_18 | | CH | JUN_18 | | NO | 2020-01-21 | | NO …
0
votes
1 answer

Improve SQL query by replacing inner query

I'm trying to simplify this SQL query (I replaced real table names with metaphorical), primarily get rid of the inner query, but I'm brain frozen can't think of any way to do it. My major concern (aside from aesthetics) is performance under heavy…
user1678312
  • 1,309
  • 3
  • 10
  • 11
0
votes
2 answers

Update field value of a table with max value of two fields of two other tables

I have some data tables with the below schema DeviceStatuses Table id, Last_Comm, Device_Id 00001, 2020-10-23, DEV1 00002, 2020-09-23, DEV2 RcptStatuses Table id, Last_Comm, Source R0001, 2020-10-25, DEV1 R0002, 2020-09-25, DEV2 R0003, 2020-10-30,…
Kavinda Jayakody
  • 705
  • 1
  • 13
  • 25
0
votes
1 answer

MySQL: From sub query to a single query

I have this query which i believe can be optimized: SELECT floors.id, floors.floor FROM floors WHERE floors.societies_id = 1 AND floors.status = 'Y' AND floors.id NOT IN ( SELECT DISTINCT(floors.id) FROM floors INNER JOIN societies ON…
Mr.Singh
  • 1,421
  • 6
  • 21
  • 46
0
votes
2 answers

Filter out records in specified day of week in PostgreSQL

I have inner query which is returning a specified date according to the date between condition. im successfully getting results but in outer query i want to check whether date is in the string i have provided ex-'Friday,Saturday' SELECT * from…
Malinda Peiris
  • 583
  • 2
  • 8
  • 22
0
votes
1 answer

Difference between two identical tables in mysql

I've two tables that are defined exactly the same but have different number of rows. There are five fields that are partial keys of the tables(which is the primary key for both the tables). I wanted to find the rows that are in one table but no the…
0
votes
0 answers

How to get NIC count for each virtual machine (SQL Server 2016)

This is a follow-up to my earlier question Find max count of query (SQL Server 2016) Q1) How do I get the NIC count per virtual machine? e.g. VirtualMachineName vCenter Cluster NicCount ------------------ --------- ----------- …
aenagy
  • 37
  • 6
0
votes
3 answers

Can the result set of inner query can be displayed with final result set

I have a table that contains some data say ==================== Record | Record_Count 1 | 12 3 | 87 5 | 43 6 | 54 1 | 43 3 | 32 5 | 65 6 | 43 I have a query that returns Record Count…
Naveen Yadav
  • 203
  • 9
  • 25
0
votes
1 answer

Inner Query Work Flow

While execute below Query , its executed successfully. But when execute only (SELECT CREDITDOCUMENTID FROM TBLTPAYMENT ) it is give error like "00904. 00000 - "%s: invalid identifier"". Doesn't know how its work in oracle 12c database. SELECT…
SamDPatel
  • 1
  • 1
0
votes
6 answers

inner query in laravel 5.3 query builder

I tried to get data using Laravel inner query like but I face a problem where I pass value variable as value my query is as below. $seller_name = $request->seller_name; $supplier_address = DB::table('supplier_addresses') …
HirenMangukiya
  • 645
  • 3
  • 13
  • 30