我有3个表,它们在SQLite数据库中没有任何关系。查询返回所有表字段后,检查3个表是否存在值的SQL查询
我不得不返回有关3桌在那里我有一个条件,像这样的东西之一的所有字段:
(table1.field1="something" and table1.field2="something") OR (table2.filed1="something" and table2.field2="something") ...
所以我想知道什么表有场“东西”而归该表的其他领域与这些信息。
如果问题根本不明确,我会尽力解决问题。
编辑:
我想是这样的:
SELECT idpontosturisticos,idrestauracao,idalojamento from Alojamento,pontosturisticos ,restauracao WHERE (alojamento.latitude=41.158764 AND alojamento.longitude=-7.784906 AND alojamento.nome='Restaurante1') OR (pontosturisticos.latitude=41.158764 AND pontosturisticos.longitude=-7.784906 AND pontosturisticos.nome='Restaurante1') OR (restauracao.latitude=41.158764 AND restauracao.longitude=-7.784906 AND restauracao.nome='Restaurante1')
请提供样本输入,样本输出并告诉我们[你试过的东西](http:// whathaveyoutried .COM)。 – 2013-06-12 16:44:38
这些表格是否有多行?如果是这样,你将如何决定哪些行进行比较,因为你的表格(正如你指出的那样)*没有它们之间的任何关系*? –
我用一个我试过的例子来编辑帖子。 –