1 Replies - 267 Views - Last Post: 25 January 2011 - 04:02 PM

#1 Apprentice123  Icon User is offline

  • D.I.C Regular

Reputation: -16
  • View blog
  • Posts: 265
  • Joined: 30-June 08

Where in SQl

Posted 25 January 2011 - 11:15 AM

How can I make a junction where-clause in sql, with and?

It's correct:
" WHERE aux1 =" & VAR1 & "and aux2=" & VAR2 


?
Is This A Good Question/Topic? 0
  • +

Replies To: Where in SQl

#2 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 4421
  • View blog
  • Posts: 12,286
  • Joined: 18-April 07

Re: Where in SQl

Posted 25 January 2011 - 04:02 PM

That is correct if you are looking for all rows that match aux1 = var1's value AND aux2 = var2's value. To do joins through keys you can also do...

where table1.field = table2.field and table2.field2 = 'some value'



Here is one where we do an AND and an OR...

where (table1.field = 'some value' and table1.field2 = 'some other value') OR table1.field3 = 'yet another value'



Hopefully this is answering your question. :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1