SQL Subquery confusion

  • 2017-07-16 20:42

    SQL Subquery confusion

    Here is what I am trying to do. I am close, but I just can not get it...a bit confused since the data is in 3 separate tables. I uploaded the database here: http://www.filefactory.com/file/b3474b4/n/instnwnd.sql Write a subquery that shows all of the

  • 2014-09-12 03:48

    Need help with a SQL subquery

    I need help with a SQL subquery here since this forum seems to be more helpful that some of the others I am on and saw a couple post here about SQL alone so here goes. I have a table (as a result of a query) showing this information: +--------------+
  • 2012-01-03 23:19

    SQL subquery memo field error

    I could use some help with a problem I've been struggling with at work. I try to do queries in one shot, without building views. I have a standard query, and want to enclose a subquery select to only pull 1 (top record), but get errors because it's a
  • 2012-01-09 05:35

    SQL subquery can return only one result

    Hello, I'm trying to do a query so I retrieve data from a table depending on the data asociated to it... let me explain.... I have a table called photos which holds images and some other data about them. Asociated to this table is another one callled
  • 2012-10-13 00:18

    SQL Subquery Error Help !!

    I have a problem with an SQL server query. The error that I am getting is the subquery returns more than one value.This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. The fol
  • 2013-08-10 05:00

    sql statement ~ confusing :( dates

    Hi, i'm just new to this, was wondering if someone could help me out possibly... I have a booking system im working on where you can book a time period, from one date (checkindate) to another (checkout), these are stored in a mysql db. I've written s
  • 2014-12-02 19:37

    T SQL Subquery returning multiple results

    In a sub-query that returns multiple results, is there a way to take those results and return them as a list so the query doesn't fail? The error I'm getting is: SQL Server Database Error: Subquery returned more than 1 value. This is not permitted wh
  • 2012-01-13 03:42

    Nested SQL/Subquery & Aggregate functions

    Hi! I'm trying to write some sql that groups by one value (a shop branch) from a subset of data (a set of sales, selected by tranasaction dates). Basically, I want to be able to set a date range and it adds all the sales up per branch, instead of gro
  • 2012-02-16 15:21

    Oracle SQL Subquery Testing at Home on XP

    all squealers - users of SQL, ha, of course. I want to use a test database supplied by Oracle on my home desktop PC running Windows XP to run tests on SQL subqueries to better learn how they work and maybe do advanced features like Cube, etc. - my ow
  • 2012-10-11 23:57

    SQL Server confusion, Global.asax behavior

    Some generic questions please: 1) The SQL server can handle database files made by Access'00 ? Or it has nothing to do with the format of the database file? 2) I have a database file. All I need is to make it available on the web, only through my asp
  • 2013-03-04 00:31

    Oracle PL/SQL subquery bug?

    The following SQL statement works fine but causes a compile error when used in PL/SQL: insert into temp_rek ( select ( select 1 from dual where dummy = 'X' ) as c from dual ); When you try it in PL/SQL (just wrap it with 'begin' and 'end;' in sql*plu
  • 2013-04-19 22:35

    Oracle Complicated SQL subquery

    The basic call would just be select col from tab where condition tab col col2 cond _______________ 1 4 7 2 5 8 3 6 9 Now the complicated portion: If information exists in my row I want that those rows, and if it doesn't exist, I want it to return nul
  • 2014-01-10 22:54

    Oracle Help Required With SQL Subquery Across DB Link - Takes Long Time

    Apologies if this is not the correct forum but I am implementing this through HTMLDB. I am trying to run a SQL query over a DB link with a sub query on tables in my HTMLDB workspace. The SQL query over the database link takes 1.23 seconds to run on i
  • 2015-05-07 00:26

    SQL Subquery-Urgent !!!!

    Need urgent help in sorting this SQL statement in VB6.0, Access 2000. The SQL query that I passed was like this:- "select (select distinct(Txn_Date) as [Income Date], sum(Amount) as Income from transaction_Table where Txn_type = 'Credit' group by Dat
  • 2012-09-28 02:32

    Oracle Need help in SQL - subquery

    I have 2 tables. Tbl1 (col1, col2) Tbl2 (col1, col2) all columns are varchar I am writing a sub query like: select * from tbl1 where col1 in (select col1 from tbl2) this works perfectly 1) Now I am writing a function which returns a single value crea
  • 2012-10-20 11:17

    Oracle Problem with SQL subquery URGENT Help appreciated

    I have three columns (class,section,enrolled# )where the data looks this class section enrolled# 10 SLa 4 10 SLb 52 16 SLc 29 16 RO 5 24 SLe 10 24 SLd 45 24 SLa 4 2k SLb 2 2K FBr 1 2K FBt 15 My prob is I want to select class , section with the follow
  • 2013-03-10 19:47

    SQL subquery help

    How can i make this query work? thanks in advance SELECT CustomerID, OrderDate, ShippedDate FROM Orders WHERE (CustomerID, OrderID) IN (SELECT CustomerID, MAX(OrderID) FROM dbo.Orders GROUP BY CustomerID)
  • 2013-05-05 01:53

    Oracle Help with sql subquery/grouping

    Hi... having trouble getting this query to work. Here's the table and data: create table mytable ( rec_num number, status_num number, status_date date ); insert into mytable values (1,1,'01-AUG-2006'); insert into mytable values (1,2,'14-AUG-2006');
  • 2014-05-07 10:00

    SQL subquery problems; programming a friend's application

    I'm trying to return multiple values so I can get the first and last name of everyone that's your "friend" here's a look at the new code that I was trying to use. if (isset ($_POST['submitted'])) { //check if form is submitted $id = $_POST['mid']; $q
  • 2014-12-02 21:54

    Oracle sql - subquery

    I have a table like this select * from test_table; col1 col2 col3 ---- ---- ---- 1 1 2002 1 2 2002 1 3 2002 2 1 2002 2 2 2002 3 1 2002 3 3 2002 I want to extract all the common col2s(months) and col3s(years) for a given col1s(ids) for Ex1: When the c