Hi Everyone.

Could someone assist me in the query.
The table has type_of_vehicle field. In this field I have A, B and M.

I would like to create a query where I can specify to select A and B, or A and M or A,B,M.

Hope someone could assist me in this.

Thanks

Recommended Answers

All 4 Replies

Could someone assist me in the query.
The table has type_of_vehicle field. In this field I have A, B and M.
I would like to create a query where I can specify to select A and B, or A and M or A,B,M.

Your question is not clear....
What you want to do .... just give detail about that....


Highlighted should be more clear....

Hello,

Assuming you want all fields returned.

SELECT * FROM table
where type_of_vehicle = 'A' or type_of_vehicle = 'B'

SELECT * FROM table
where type_of_vehicle = 'A' or type_of_vehicle = 'M'

SELECT * FROM table
where type_of_vehicle IN ( 'A', 'B', 'M')

hi

to selected ALL

SELECT * FROM TABLENAME(YOU SPCIFY YOUR TABLE NAME)
where type_of_vehicle IN('A','B','M')

or you dirctly write this way if ther is only three field (A,B&M)

SELECT * FORM TABLE NAME

to selecte ONLY A&B

SELECT * FROM TABLENAME(YOU SPCIFY YOUR TABLE NAME)
where type_of_vehicle='A' or type_of_vehicle = 'B'


to selecte A&M

SELECT * FROM TABLENAME(YOU SPCIFY YOUR TABLE NAME)
where type_of_vehicle='A' or type_of_vehicle = 'M'

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.