Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

thiagocs

SELECT em várias tabelas

Recommended Posts

Tenho várias tabelas que contém um único campo. Preciso fazer um Select(like) nelas e retornar o like encontrado e a tabela que está. Isso é urgente.

 

Agradeço a atenção !!!

Compartilhar este post


Link para o post
Compartilhar em outros sites

fala thiagocs,select tab1.campo1 as tab1, tab2.campo2 as tab2, tab3.campo3 as tab3from tab1,tab2,tab3where campo1 like '%"&param&"%' or campo2 like '%"&param&"%' or campo3 like '%"&param&"%' ve se resolve..

Compartilhar este post


Link para o post
Compartilhar em outros sites

No retorno do SELECT está saindo mta coisa!!!

 

 

<form method="POST" action="default.asp">  <p>nome: <input type="text" name="nome" size="20">    <input type="submit" value="Submeter" name="B1"></p></form><%nome = request("nome")IF nome <> "" THENdata = "DBQ=C:\Inetpub\wwwroot\cds\musicas.mdb"data = data & ";Driver={Microsoft Access Driver (*.mdb)}"Set Conexao = Server.CreateObject("ADODB.Connection")Conexao.Open dataSQL = "select eins.nome as eins, zwei.nome as zwei, drie.nome as drie, vier.nome as vier, funf.nome as funf, sechs.nome as sechs, sieben.nome as sieben, acht.nome as acht,  neun.nome as neun, zehn.nome as zehn, elf.nome as elf"SQL = SQL&" from eins,zwei,drie,vier,funf,sechs,sieben,acht,neun,zehn,elf"SQL = SQL&" where eins.nome like '%"&nome&"%' OR zwei.nome like '%"&nome&"%' OR drie.nome like '%"&nome&"%' OR vier.nome like '%"&nome&"%' OR funf.nome like '%"&nome&"%' OR sechs.nome like '%"&nome&"%'"SQL = SQL&" OR sieben.nome like '%"&nome&"%' OR acht.nome like '%"&nome&"%' OR neun.nome like '%"&nome&"%' OR zehn.nome like '%"&nome&"%' OR elf.nome like '%"&nome&"%'"Set RS = Conexao.Execute(SQL)IF NOT RS.EOF THEN%><table border="1" width="100%">  <tr>    <td width="9%" align="center">EINS</td>    <td width="9%" align="center">ZWEI</td>    <td width="9%" align="center">DRIE</td>    <td width="9%" align="center">VIER</td>    <td width="9%" align="center">FUNF</td>    <td width="9%" align="center">SECHS</td>    <td width="9%" align="center">SIEBEN</td>    <td width="9%" align="center">ACHT</td>    <td width="9%" align="center">NEUN</td>    <td width="9%" align="center">ZEHN</td>    <td width="10%" align="center">ELF</td>  </tr><%DO WHILE NOT RS.EOF%>  <tr>    <td width="9%"><%=RS("eins")%></td>    <td width="9%"><%=RS("zwei")%></td>    <td width="9%"><%=RS("drie")%></td>    <td width="9%"><%=RS("vier")%></td>    <td width="9%"><%=RS("funf")%></td>    <td width="9%"><%=RS("sechs")%></td>    <td width="9%"><%=RS("sieben")%></td>    <td width="9%"><%=RS("acht")%></td>    <td width="9%"><%=RS("neun")%></td>    <td width="9%"><%=RS("zehn")%></td>                    <td width="9%"><%=RS("elf")%></td>          </tr><%RS.MOVENEXTLOOPEND IF%></table><%END IF%>

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.