2

In following query, is there any possibility to having different results for different conditions?

SELECT * FROM `table` WHERE ((COND1) || (COND2) || (COND3 AND COND4) || COND5);

I mean if search token stoped at a record for COND2 then result having some number or anything that we want. some thing like this:

I need something like this

SELECT someVar FROM `table` WHERE ((COND1 then someVar=5)...

that results something like this:

╔═════════╗
║ someVar ║
╠═════════╣
║    5    ║
╠═════════╣
║    6    ║
╠═════════╣
║    19   ║
╚═════════╝

In my case I want to search duplicates in some specific cases so I'm giving a bunch of ids and duplicate conditions to a query, and I need that query returns me which id has a dupicate, it returns me which id is duplicate by given id. sorry for my bad english

this is my query:

SELECT `bId` FROM `betmatches` WHERE `user`='1' AND `status`='paid' AND ((`zpo`='zpo2' AND `mId`='2355') OR (`zpo`='zpo2' AND `mId`='2367'))

if following condition was true

(`zpo`='zpo2' AND `mId`='2355')

i need query to result me some number like 5

Pejman
  • 2,442
  • 4
  • 34
  • 62

1 Answers1

0

You mean like the following?

Select name FROM foo WHERE zip_code=76110 OR state='TX' or a=1 AND b=1

Make sure you understand ORs, ANDs, and XORs.

Lelio Faieta
  • 6,457
  • 7
  • 40
  • 74
David Stokes
  • 120
  • 3
  • I didn't mean that, i want to search duplicates in some specific case so i'm giving a bunch of ids and duplicate conditions to a query, and I need that uery returns me which id has a dupicate, it returns me which id is duplicate by given id. sorry for my bad english – Pejman Nov 29 '16 at 15:36