Skip to content

Tag: sql

Endless Loop or No Output for Recursive SQL Query

I have the following table, My goal is to create a supervisor view in which there is a 4th column that has the name of the supervisor that matches the S code. My query returns to me either nothing except the column headers or a never ending recursion that loops into the 100,000’s. What I’ve writte…

How to create a view using data from two tables

I have two tables ITEM id (int), model (varchar), weight (float), fk_type (int) TYPE id (int), name (varchar) And I want to create a view with TypeName (for every type name) –> varchar NumberOfItems (total number of ITEMS for TypeName) —> int NumberOfModels (total number of MODELS for TypeNa…

SQL query to combine the results from two tables

I have these two tables and I want to build a SQL query: My search criteria is: Name (in field Brother and field Speaker) Congregation (in field Congregation in both tables) I want the resulting view to be a single list of all records, sorted by date (fields Talk Date and Last Given). So: Away Talks I am inte…

Problem using create view and explain plan

I want to test the efficiency of this query using explain plan for. The query works without the explain plan but when I use it I get this errors: I used explain plan on queries without create view and they worked. I don’t know what is causing the error I have tried changing the parenthesis but I get the…