Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6360599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:40:08+00:00 2026-05-24T23:40:08+00:00

Why is the first statement not returning the number of the 2nd? select random_selection.randnum,

  • 0

Why is the first statement not returning the number of the 2nd?

select random_selection.randnum,
   random_selection.createddate,
   random_selection.ozip3, 
   random_selection.boxid, 
   random_selection.boxaddr, 
   random_selection.locdesc, 
   random_selection.loccity, 
   random_selection.lastmf,
   random_selection.lastsat,
   random_selection.boxtype,
   random_selection.svcclas,
   random_selection.dropzip5,
   dropper_city_brk_2.dropper_id
from random_selection, dropper_city_brk_2
where random_selection.ozip3 = dropper_city_brk_2.zip3
and dropper_city_brk_2.dropper_id <> 10002
and random_selection.dropper_id is null
order by dropper_id;

Second statement:

select count(*) from random_selection where dropper_id is null; 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T23:40:09+00:00Added an answer on May 24, 2026 at 11:40 pm

    Your queries are not the same so your record count would not be the same. You first query is joining on 2 tables and your second query is only getting the record count of one table. Plus you have WHERE clauses on your first query that are not on the second.

    If you want your second query to return the same number of records then you have to use the same tables and where clause that you have in the first

    select count(*) 
    from random_selection, dropper_city_brk_2
    where random_selection.ozip3 = dropper_city_brk_2.zip3
    and dropper_city_brk_2.dropper_id <> 10002
    and random_selection.dropper_id is null
    

    EDIT:

    select count(*) 
    from random_selection 
    INNER JOIN dropper_city_brk_2
      ON random_selection.ozip3 = dropper_city_brk_2.zip3
    WHERE dropper_city_brk_2.dropper_id <> 10002
      and random_selection.dropper_id is null
    

    Here is a visual explanation of JOINs that might be helpful as a reference.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

// First, prepare the statement, using placeholders $query = SELECT * FROM tableName; $stmt
I have this select statement where I check whether phone number in null or
I have an application where the user selects the dates of a first statement
#include<stdio.h> #include<signal.h> #include<stdlib.h> void handler(int signo) { printf(First statement); system(date); exit(EXIT_SUCCESS); } int main()
Why does the first if statement evaluate to true? I know if I use
In the following code, the first log statement shows a decimal as expected, but
I have an sql statement that is supposed to return 2 rows. the first
I got the problem that the if-statement doesn't work. After the first code line
I am running a select statement in a report that returns 30 rows in
This if statement is not working. I am trying to make it so that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.