select same record from multiple table

sql India
  • 12 years ago

    hi all,

    I have a pblm to select the same field namely tripid from multiple tables.

    Actually i want to exclude a tripid if it is in any of the table with same route.

    i need to check if it is in any of there is four tables tb1, tb2 tb3, tb4....

    can anybody help me....

    thank you


  • 12 years ago
    Hi, You will have to provide more information in order to receive a meaningful response, what exactly do your tables llok like?  Without seeing your table structure I would guess that you could use a NOT IN query, ie. select tripid from yourtable where tripid not in(select tripid from tb1) and tripid not in(select tripid from tb2) and tripid not in(select tripid from tb3) etc.. 

    I will try and help further if you give more information.

Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Some people, when confronted with a problem, think "I know, I’ll use regular expressions." Now they have two problems.” - Jamie Zawinski