Welcome, Guest: Join Nairaland / LOGIN! / Trending / Recent / New
Stats: 2,712,013 members, 6,406,089 topics. Date: Monday, 26 July 2021 at 06:23 PM

[Resolved Issue] Sql Syntax Needed - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / [Resolved Issue] Sql Syntax Needed (815 Views)

Programming Your Own Code Syntax Highlighter / Java Syntax Highlighter For Smf 1.0.12 / Parse Error: Syntax Error, Unexpected T_else In C:\ (2) (3) (4)

(1) (Go Down)

[Resolved Issue] Sql Syntax Needed by BigStar1(m): 9:48pm On Nov 20, 2012
Dear everyone, please I need to select some values from a table(A), but those records must not be contained in another table(B). I.e. All records in A that are not in B. Thanks
Re: [Resolved Issue] Sql Syntax Needed by naijaswag1: 1:45pm On Nov 21, 2012
Try using set notation for sql: union,minus or intersect will do that for you. I know these are supported on oracle. For this situation, minus will do.
Re: [Resolved Issue] Sql Syntax Needed by saintiyke(m): 6:28pm On Nov 21, 2012
U can use JOIN or write a subquery. ......... E.g. Using subqueries;
SELECT columnA,....,
FROM TableA
WHERE ( SELECT columnB, ......,
FROM TableB);
Re: [Resolved Issue] Sql Syntax Needed by saintiyke(m): 6:31pm On Nov 21, 2012
saintiyke: U can use JOIN or write a subquery. ......... E.g. Using subqueries;
SELECT columnA,....,
FROM TableA
WHERE ( SELECT columnB, ......,
FROM TableB);
. ....... Represents other columns u might want to select.
Re: [Resolved Issue] Sql Syntax Needed by saintiyke(m): 6:33pm On Nov 21, 2012
In using JOIN, u must know the primary key and the foreign key of each table
Re: [Resolved Issue] Sql Syntax Needed by BigStar1(m): 3:01pm On Nov 22, 2012
Many thanks to you all for your contribution. I have tried using Join before posting it on NL. I was not getting it right. Can you just help me post the query here. Thanks
Re: [Resolved Issue] Sql Syntax Needed by Listener10: 10:53pm On Nov 22, 2012
try this if it will work. Select column1,column2,... From tableA Minus Select column1,column2,... From tableB;
Re: [Resolved Issue] Sql Syntax Needed by Nobody: 11:15pm On Nov 22, 2012
I'm learning.
Re: [Resolved Issue] Sql Syntax Needed by saintiyke(m): 8:35am On Nov 23, 2012
Listener10: try this if it will work. Select column1,column2,... From tableA Minus Select column1,column2,... From tableB;
where is the relationship between TableA and TableB ? I dont think it worths trying as u will surely get an error
Re: [Resolved Issue] Sql Syntax Needed by Listener10: 9:12am On Nov 23, 2012
saintiyke: where is the relationship between TableA and TableB ? I dont think it worths trying as u will surely get an error
guy,the op didnt state d relationship btw d two tables. We dont know d structure of the two tables.you can only write out the relationship btw two tables when u know their structures.the op only asked for d syntax and not d actual statement.he'll be d one to complete d statements since he's d only person that knows d structure of d tables.what i gave is just a clue.how do u expect me to know d relationship btw two tables when i dont know d primary key or d foreign keys of d tables
Re: [Resolved Issue] Sql Syntax Needed by Nobody: 10:56am On Nov 23, 2012
Big Star: Dear everyone, please I need to select some values from a table(A), but those records must not be contained in another table(B). I.e. All records in A that are not in B. Thanks

are you trying to select from table A only, the values not in table B
then you may want to use subqueries

SELECT * FROM tableA WHERE tableA.id not in (select id from tableB)

1 Like

Re: [Resolved Issue] Sql Syntax Needed by BigStar1(m): 3:07pm On Nov 23, 2012
webdezzi:
SELECT * FROM tableA WHERE tableA.id not in (select id from tableB)

Wow! Thanks so much. This code works like magic. @moderators, kindly provide a button for marking a post as resolved. Thanks everybody.
Re: [Resolved Issue] Sql Syntax Needed by mitey(m): 11:39am On Nov 24, 2012
Big Star:

Wow! Thanks so much. This code works like magic. @moderators, kindly provide a button for marking a post as resolved. Thanks everybody.

Simply modify the topic and add [Solved] at the beginning.

(1)

Whats The Minimum Laptop Specs For Programming / Join The Ongoing Mobile Application Development Project / Have An App Idea, What Next?

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2021 Oluwaseun Osewa. All rights reserved. See How To Advertise. 40
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.