Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Syntax for Select Statement

syntax

  • Please log in to reply
2 replies to this topic

#1 newphpcoder

newphpcoder

    CC Devotee

  • Senior Member
  • PipPipPipPipPipPip
  • 527 posts

Posted 12 December 2010 - 06:16 PM

Good day!


I want to know if what is the correct sysntax for Selecting multiple data in one column.


I have a table trace and i have column name and id
my list name are: name1, name1total, name2,name2total,name3,name4, and name5, but i wamnt to select only is the name 1,name3,name4, and name5
I have a table trans and it has id.

I try this code:

SELECT t.name FROM trace t, trans c WHERE t.name = 'name1' || 'name 3' || 'name4' || 'name5' AND t.id=c.id;

In that code all the name was selected eventhough I did not select the name1total,name2,name2total.

Thank you
  • 0

#2 wim DC

wim DC

    Roar

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 2681 posts
  • Programming Language:Java, JavaScript, PL/SQL
  • Learning:Python

Posted 13 December 2010 - 12:13 AM

I'm not quite sure on
t.name = 'name1' || 'name 3' || 'name4' || 'name5'
Try
t.name='name1' OR t.name='name 3' OR ...
or better
t.name IN ('name1', 'name3', '....)

  • 0

#3 newphpcoder

newphpcoder

    CC Devotee

  • Senior Member
  • PipPipPipPipPipPip
  • 527 posts

Posted 13 December 2010 - 02:08 AM

thank you
  • 0





Also tagged with one or more of these keywords: syntax

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download